PHP string helper functions that add familiar functionality from other languages (like string contains, splitting, truncating, etc...)
You can install the package via composer:
composer require sfneal/string-helpers
In order to autoload to the helper functions add the following path to the autoload.files section in your composer.json.
"autoload": {
"files": [
"vendor/sfneal/string-helpers/src/strings.php"
]
},
Example use of the 'truncate' helper and method.
# using StringHelpers import
use Sfneal\Helpers\Strings\StringHelpers;
(new StringHelpers("here is a long string we'd like to truncate"))->truncate(12);
>>> here is a lo...
# using autloaded helpers
truncateString("here is a long string we'd like to truncate", 12);
>>> here is a lo...
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email stephen.neal14@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the PHP Package Boilerplate.