PHP code example of realodix / change-case

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

    

realodix / change-case example snippets


use Realodix\ChangeCase\ChangeCase;

ChangeCase::header('TestV2', ['separateNum' => true]);
// 'Test-V-2'

ChangeCase::camel('test string');
// 'testString'

ChangeCase::camel('1twoThree');
// '1twoThree'
ChangeCase::camel('1twoThree', ['separateNum' => true]);
// '1TwoThree'

ChangeCase::constant('test string');
// 'TEST_STRING'

ChangeCase::dot('test string');
// 'test.string'

ChangeCase::header('test string');
// 'Test-String'

ChangeCase::headline('test string');
// 'Test String'
ChangeCase::headline('steve_jobs');
// Steve Jobs
ChangeCase::headline('EmailNotificationSent');
// Email Notification Sent

ChangeCase::kebab('test string');
// 'test-string'

ChangeCase::kebab('Foo123Bar');
// 'foo123-bar'
ChangeCase::kebab('Foo123Bar', ['separateNum' => true]);
// 'foo-123-bar'

ChangeCase::no('testString');
// 'test string'

ChangeCase::no('Foo123Bar')
// foo123 bar
ChangeCase::no('Foo123Bar', ['separateNum' => true])
// foo 123 bar

ChangeCase::pascal('test string');
// 'TestString'

ChangeCase::path('test string');
// 'test/string'

ChangeCase::sentence('testString');
// 'Test string'

ChangeCase::snake('test string');
// 'test_string'

ChangeCase::snake('Foo123Bar');
// 'foo123_bar'
ChangeCase::snake('Foo123Bar', ['separateNum' => true]);
// 'foo_123_bar'

ChangeCase::swap('Test String');
// 'tEST sTRING'