jxcodes / php-string-max
This package is abandoned and no longer maintained.
The author suggests using the jlibs/php-string-max package instead.
Util functions for string formating.
v1.3.1
2024-06-20 10:47 UTC
Requires
- php: >=5.5
README
StringMax
Singleton class for string formating and templating.
Install
composer require jlibs/php-string-max
Usage:
require __DIR__ . '/../vendor/autoload.php'; use JLibs\StringMax;
Example 1:
echo StringMax::format( 'Hi {{name}}, keep {{tip}}!', [ 'name' => 'developer', 'tip' => 'building' ] ); // prints: Hi developer, keep building!
Example 2:
$result = StringMax::replaceTokensInArray([ 'Hi {{name}}, remember to be {{tip}}.', 'Because {{myTarget}} love nice {{myTarget}}', 'and' => [ 'the world is better if we have more {{mates}}.' ] ], [ 'name' => 'developer', 'tip' => 'nice', 'myTarget' => 'people', 'mates' => 'friends' ] ); /* Results: $result = [ 'Hi developer, remember to be nice.', 'Because people love nice friends', 'and' => [ 'the world is better if we have more friends.' ] ] */