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::headline('php_v8.3'); // 'Php V8.3'
ChangeCase::title('php_v8.3');    // 'Php_V8.3'

ChangeCase::headline('phpV8.3'); // 'Php V8.3'
ChangeCase::title('phpV8.3');    // 'Phpv8.3'

ChangeCase::headline('_foo_'); // 'Foo'
ChangeCase::title('_foo_');    // '_Foo_'

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'

ChangeCase::title('a simple test');
// 'A Simple Test'

ChangeCase::headline('php_v8.3'); // 'Php V8.3'
ChangeCase::title('php_v8.3');    // 'Php_V8.3'

ChangeCase::headline('phpV8.3'); // 'Php V8.3'
ChangeCase::title('phpV8.3');    // 'Phpv8.3'

ChangeCase::headline('_foo_'); // 'Foo'
ChangeCase::title('_foo_');    // '_Foo_'