On the Laravel News site there's a post spotlighting an interesting string manipulation library (Twine) and some of its basica features and use.
Twine is a stand-alone PHP 7 package by Chris Kankiewicz for string manipulation and comparison with an expressive fluid syntax.
They provide several code examples showing the package in action:
- adding padding to the left/right
- uppercase/lowercase
- starts with/contains/ends with
- converting the string to a hash
- basic string formatting
The package also makes use of a fluent interface, making it easier to stack multiple operations onto a string (like checking to see if a substring equals a value). You can find out more about the package on its GitHub repository.