The package provides:
- StringHelper that has static methods allowing dealing with strings more efficiently;
- Inflector provides methods such as
pluralize()
orslug()
that derive a new string based on the string given.
composer require yiisoft/strings
StringHelper methods are static so usage is like the following:
echo \Yiisoft\Strings\StringHelper::countWords('Strings are cool!'); // 3
Inflector usage is the following:
echo (new \Yiisoft\Strings\Inflector())->withoutIntl()->slug('Strings are cool!'); // strings-are-cool
Check both classes to find out about the methods available.