dev-master
9999999-devHelper for project
MIT
The Requires
- php >=5.6
- phpunit/phpunit ^6.4
by Reza Juliandri
helpers library helpers library
Wallogit.com
2017 © Pedro Peláez
Helper for project
First time you must include src/Str.php in your project for use this helper. Coming soon i will add this project with composer. For Example code you can see in example folder., (*1)
there is many types of uses. they are mention below., (*2)
You can use strip Quotes helper for string or multiple data with array., (*3)
$data = 'Test String "'; Str::strip_quotes($data);
You can use Strip Slashes helper for string or multiple data with array., (*4)
$data = 'Test String \' '; Str::strip_slashes($data);
You can use Random String helper for random string in data. Here in list. 1. alnum for Alphanumeric 2. alpha for Alphabet 3. numeric for Numeric 4. md5 for MD5 5. hex for Hex 6. binary for Binary text, (*5)
Str::random(); // Default is alnum Str::random(18,'alnum'); //Alnum result Str::random(18,'alpha'); //Alpha result Str::random(18,'numeric'); //Numeric result Str::random(18,'md5'); //MD5 result Str::random(18,'hex'); //Hex result Str::random(18,'binary'); //Binary result
You can use Alternator helper for alternating., (*6)
for ($i = 0; $i < 10; $i++)
{
echo Str::alternator('one', 'two', 'three', 'four', 'five');
}
You can use this helper to reverse the case of each letter in a string. ```php $data = 'tESt stRinG'; Str::reverse_case($data); // Test String, (*7)
#### 6. Title Case You can use Title Case helper for making a string or array of strings title case. ```php $data = 'test strinG'; Str::title_case($data); // Test String
You can use Limit helper to limit a string or array of strings up to specified length., (*8)
$data = 'test string';
Str::limit($data, 4);
// test
You can use Contains helper to check if specific word or key exists in a string., (*9)
$data = 'test string';
Str::contains($data, 'test');
// true
You can use Camelize helper to camelize a string., (*10)
$data = 'example_test-string';
Str::camelize($data);
// ExampleTestString
You can use Array key starts with helper to find an array key that starts with a given term, (*11)
$array = [
'pizza pie' => 'nomnom',
'hot dog' => 'ohnomnom'
];
Str::array_key_starts_with($array, 'hot');
// ['hot dog' => 'ohnomnom']
You can use Array key ends with helper to find an array key that ends with a given term, (*12)
$array = [
'pizza pie' => 'nomnom',
'hot dog' => 'ohnomnom'
];
Str::array_key_ends_with($array, 'pie');
// ['pizza pie' => 'nomnom']
Determine if two arrays are identical with the same index values ignoring key ordering, (*13)
$array = [
'foo' => 'bar'
];
Str::arrays_match($array, $array);
// true
Return snake case format of the given string, (*14)
$string = 'heLLo World ya`ll';
Str::snake_case($string));
// hello_world_ya`ll
# With delimiter
Str::snake_case($string, '-'));
// hello-world-ya`ll
Return lower case of the given string. Works with UTF-8, (*15)
$string = 'Hello WorLD';
Str::lower_case($string));
// hello world
Return upper case of the given string. Works with UTF-8, (*16)
$string = 'Hello WorLD';
Str::upper_case($string));
// HELLO WORLD
See also the list of contributors who participated in this project., (*17)
Helper for project
MIT
helpers library helpers library