lukehayes / str-utils
String utility helper functions for PHP.
dev-master
2021-04-20 19:24 UTC
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.2
This package is auto-updated.
Last update: 2025-06-21 04:52:13 UTC
README
A library of string helpers, to aid a developer.
This is really a small helper project to help with my own needs when I need to alter a string in some way. Rather than trying to remember built in PHP functions, why not make them available in a simple to use API?
Examples
First, require the library using:
require "vendor/autoload.php"; use LH\StrUtils;
then call the static methods:
PascalCase
StrUtils::PascalCase("string utils") # returns StringUtils
CamelCase
StrUtils::CamelCase("string utils") # returns stringUtils
SnakeCase
StrUtils::SnakeCase("string utils") # returns string_utils
Size
StrUtils::Size("string utils") # returns 12
ConvertToInt
StrUtils::ConvertToInt("A") # returns 65
Uglify
StrUtils::Uglify(<A string containing code>)