khuddus / php-camel-case-helpers

A php library provides camel case helpers. You can use array helper, to convert an array to camelCase keyed array, or you can use string helper to convert a string to camel case.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php camel case helpers

Latest Version on Packagist Software License Build Status Total Downloads

A php library provides camel case helpers. You can use array helper, to convert an array to camelCase keyed array, or you can use string helper to convert a string to camel case.

Structure

If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.

bin/        
build/
docs/
config/
src/
tests/
vendor/

Install

Via Composer

$ composer require khuddus/php-camel-case-helpers

Usage

use Khuddus\Helpers\CamelCase\ArrayHelper;
use Khuddus\Helpers\CamelCase\StringHelper;

echo StringHelper::convertToCamelCasedString("Hello world"); //echoes helloWorld
$convertedArray = ArrayHelper::convertToCamelCasedArray(['hello world'=>1]); //converts to ['helloWorld'=>1]
$convertedArray = ArrayHelper::convertToCamelCasedArray(['hello world'=>1]); //converts to ['helloWorld'=>1]
ArrayHelper::convertToCamelCasedArray([
                'Hello World'=>[
                    'My----World'=>'this world'
                ],
                [
                'another -_-_WOrld'=>[
                    'Busy_World'=>[
                        'instruMental World'=>[
                            'courageous--World'=>'mine'
                            ]
                        ]
                    ]
                ]
            ], 
            3);
/* converts it to 
            [
                'helloWorld'=>[
                    'myWorld'=>'this world'
                ],
                [
                'anotherWOrld'=>[
                    'busyWorld'=>[
                        'instruMental World'=>[
                            'courageous--World'=>'mine'
                            ]
                        ]
                    ]
                ]
            ]
*/

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email khuddus1+github@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

A php library provides camel case helpers. You can use array helper, to convert an array to camelCase keyed array, or you can use string helper to convert a string to camel case.

License:MIT License


Languages

Language:PHP 100.0%