petrenkoanton/key-normalizer

Converts snake_case to camelCase and vice versa

v2.0.0 2024-02-20 14:29 UTC

This package is auto-updated.

Last update: 2024-04-20 14:59:19 UTC


README

PHP Version Latest Version on Packagist Total Downloads License

PHP Composer Coverage Status type-coverage psalm-level Build Status

Installation | Functionality | Usage | For developers | License | Related projects

Installation

Requirements

  • php 7.4 or higher

Composer

composer require petrenkoanton/key-normalizer

Functionality

Public methods

KeyNormalizer

Method Exception
toCamelCase(string $key): string -
toSnakeCase(string $key): string -

Usage

<?php

declare(strict_types=1);

use KeyNormalizer\KeyNormalizer;

KeyNormalizer::toCamelCase('test_test_test'); // testTestTest
KeyNormalizer::toSnakeCase('testTestTest'); // test_test_test

For developers

Requirements

Utils:

Setup

Initialize

Create ./docker/.env

make init 

Build container with the different php version

php 8.0

make up80

php 8.1

make up81

php 8.2

make up82

php 8.3

make up83

Also you need to run this command before build container with another php version. It will remove network and previously created container.

make down

Other commands

Go inside of the container

make inside

Check php version

make php-v

Check package version

make v

Run tests and linters

Run PHPUnit tests with code coverage

make test-c 

Run Psalm

make psalm

Run PHP_CodeSniffer

make phpcs

Or by all-in-one command from the inside of the container

composer check-all

License

The key-normalizer library is open-sourced software licensed under the MIT license.

Related projects