Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 103 | All time: 9,767 This week: 206 |
Version | License | PHP version | Categories | |||
array-keys-case-tran 1.0.0 | GNU General Publi... | 5 | PHP 5, Text processing, Data types |
Simple library to handle words case transformation from array keys.
composer require deoliveiralucas/array-keys-case-transform
use ArrayKeysCaseTransform\ArrayKeys;
$input = [ 'first_key' => 'value' ];
print_r(ArrayKeys::toCamelCase($input));
/*
Output:
Array
(
[firstKey] => value
)
*/
$input = [ 'firstKey' => 'value' ];
print_r(ArrayKeys::toSnakeCase($input));
/*
Output:
Array
(
[first_key] => value
)
*/
use ArrayKeysCaseTransform\ArrayKeys;
use ArrayKeysCaseTransform\Transformer\AbstractTransformer;
$input = [ 'firstKey' => 'value' ];
$customTransform = new class extends AbstractTransformer {
protected function format(string $key) : string {
return str_replace('Key', 'CustomKey', $key);
}
};
print_r(ArrayKeys::transform($customTransform, $input));
/*
Output:
Array
(
[firstCustomKey] => value
)
*/
Please see CONTRIBUTING for details.
ArrayKeysCaseTransform is released under the MIT License. Please see License File for more information.
Files (16) |
File | Role | Description | ||
---|---|---|---|---|
src (1 file, 1 directory) | ||||
test (2 files, 1 directory) | ||||
.scrutinizer.yml | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
CONTRIBUTING.md | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpcs.xml | Data | Auxiliary data | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files (16) | / | src | / | Transformer |
File | Role | Description |
---|---|---|
AbstractTransformer.php | Class | Class source |
ToCamelCase.php | Class | Class source |
ToSnakeCase.php | Class | Class source |
Files (16) | / | test |
File | Role | Description | ||
---|---|---|---|---|
Transformer (2 files) | ||||
ArrayKeysTest.php | Class | Class source | ||
bootstrap.php | Aux. | Auxiliary script |
Files (16) | / | test | / | Transformer |
File | Role | Description |
---|---|---|
ToCamelCaseTest.php | Class | Class source |
ToSnakeCaseTest.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
array-keys-case-tran-2018-05-17.zip 7KB | |
array-keys-case-tran-2018-05-17.tar.gz 4KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.