PHP code example of eufony / inflector

1. Go to this page and download the library: Download eufony/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/ */

    

eufony / inflector example snippets


// Convert between `PascalCase`, `snake_case`, and `camelCase`.
echo $inflector->toPascalCase($string);
echo $inflector->toSnakeCase($string);
echo $inflector->toCamelCase($string);

// Convert between pluralized and singularized words.
echo $inflector->pluralize($string);
echo $inflector->singularize($string);

// A fake implementation based on the Null Object Pattern
// that returns any string it is given without any modifications.
$inflector = new NullInflector();

// A wrapper class to manually define exceptions to the return values of another implementation.
$inflector = new ExceptionAdapter($inflector, cases: [["id", "id", "ID"]], words: ["moose", "meese"]);

// A wrapper class around the inflector implementation by the Doctrine project.
$inflector = new DoctrineInflector();