Skip to content

markhj/text

The markhj/text library is used to read, manipulate and parse strings in a smarter, more beautiful and more OOP-like fashion.

Features

  • Treat strings like objects
  • Parse templates using a wealth of customization and tools.
  • Easily design your own syntax for parsing - or use the out-of-the-box solution
  • Handy loops moving over patterns in the text. It's a great way of searching, and a great of doing highly controlled find/replace.
  • Create re-usable and universal templating engines for your app
  • Create custom parsers with almost unmatched ease
  • Intuitive and structured ways of working with data in templating
  • Intuitive cursor object for searching in - and changing - strings

Requirements

This library requires PHP 8.0+ and the mbstring extension.

Installing

composer require markhj/text

Composer 2 is required to install this package.

Samples

You can explore some simple and more advanced samples in the samples/ directory.