PHP code example of cluedit / maskman

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

    

cluedit / maskman example snippets


use Cluedit\MaskMan;

// Convert all key in array from camelCase to snake_case.
$newArray = MaskMan::convert($array)->to('snake_case');
// or
$maskMan = new MaskMan($array);
$newArray = $maskman->to('snake_case');

// Convert all key in array from snake_case to camelCase.
$newArray = MaskMan::convert($array)->to('camelCase');
// or
$maskMan = new MaskMan($array);
$newArray = $maskman->to('camelCase');

// Convert all key in array from snake_case to PascalCase by a anomymous function.
$newArray = MaskMan::convert($array)->by('PascalCase', function(string $string) {
    return str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $string)));
})->to('PascalCase');
// or
$maskMan = new MaskMan($array);
$newArray = $maskMan->by('Pascal', function(string $string) {
    return str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $string)));
})->to('PascalCase');