This Library provides a unified S
Class that "glues" two amazing libraries. It integrates the Stringy library created by Daniel St. Jules and the StringTemplate Library create by Nicolò Martini.
The Stringy Library is a string manipulation library, while the String Template is an engine to render string templates.
This Library was created because in my projects I've been using both libraries and always ended up in having them integrated into a single class to make it's usage simpler.
Via Composer
$ composer require dcsg/stringy-template
For the full list of features of Stringy see it's documentation, for more details on the String Template you can also check their documentation.
echo S::render(
'Hello, my name is {firstName} {lastName}.',
['firstName' => 'Daniel', 'lastName' => 'Gomes']
);
// "Hello, my name is Daniel Gomes."
// Using conversion specifications from `sprintf`
echo S::render(
'I have {num%.1f} {fruit}.',
['num' => 1.5345, 'fruit' => 'oranges']
);
// "I have 1.5 oranges."
echo S::join(['one', 'two', 'three'], ', ');
// "one, two, three"
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING and CODE OF CONDUCT for details.
If you discover any security related issues, please email hi@dcsg.me instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.