1. Go to this page and download the library: Download crysalead/inflector library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
crysalead / inflector example snippets
use Lead\Inflector\Inflector;
# pluralize
Inflector::pluralize('post'); // "posts"
Inflector::pluralize('posts'); // "posts"
Inflector::pluralize('child'); // "children"
Inflector::pluralize('ContactPerson'); // "ContactPeople"
# singularize
Inflector::singularize('posts'); // "post"
Inflector::singularize('children'); // "child"
Inflector::singularize('ContactPeople'); // "ContactPerson"
# transliterate
Inflector::transliterate('の話が出たので大丈夫かなあと'); // "no huaga chutanode da zhang fukanaato"
# slug
Inflector::slug('Foo:Bar & Cie'); // "Foo-Bar-Cie"
Inflector::slug('Foo:Bar & Cie', '_'); // "Foo_Bar_Cie"
# parameterize
Inflector::parameterize('Foo:Bar & Cie'); // "foo-bar-cie"
Inflector::parameterize('Foo:Bar & Cie', '_'); // "foo_bar_cie"
# camelize
Inflector::camelize('test_field'); // "TestField"
Inflector::camelize('TEST_FIELD'); // "TestField"
Inflector::camelize('my_name\space'); // "MyName\Space"
# camelback
Inflector::camelback('test_field'); // "testField"
Inflector::camelback('TEST_FIELD'); // "testField"
# underscore
Inflector::underscore('TestField'); // "test_field"
Inflector::underscore('MyName\Space'); // "my_name\space"
Inflector::underscore('dashed-string'); // "dashed_string"
# dasherize
Inflector::dasherize('underscored_string'); // "underscored_string"
# humanize
Inflector::humanize('employee_salary'); // "Employee salary"
Inflector::humanize('author_id'); // "Author"
# titleize
Inflector::titleize('man from the boondocks'); // "Man From The Boondocks"
Inflector::titleize('x-men: the last stand'); // "X Men: The Last Stand"
Inflector::titleize('TheManWithoutAPast'); // "The Man Without A Past"
Inflector::titleize('raiders_of_the_lost_ark'); // "Raiders Of The Lost Ark"
namespace inflector\Inflector;
Inflector::pluralize('child'); // "children"
//Load custom definition for `'zz'` locale using a closure
Inflector::singular('/x$/i', '', 'zz');
Inflector::plural('/([^x])$/i', '\1x', 'zz');
Inflector::singularize('abcdefx', 'zz'); // "abcdef"
Inflector::pluralize('abcdef', 'zz'); // "abcdefx"