Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 103 | All time: 9,771 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.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
![]() |
/ | src | / | Transformer |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | test |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
Class | Class source | ||
![]() ![]() |
Aux. | Auxiliary script |
![]() |
/ | test | / | Transformer |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
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. |
![]() |
![]() | 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.