1. Go to this page and download the library: Download erdemuk/case-converter 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/ */
erdemuk / case-converter example snippets
use CaseConverter\CaseConverter;
$input = 'hello_world';
$converted = CaseConverter::convertCase($input, new KebabCase);
echo $converted; // hello-world
use CaseConverter\CaseConverter;
$input = 'hello_world';
$converted = CaseConverter::convertCase($input, new KebabCase);
echo $converted; // hello-world
use CaseConverter\CaseConverter;
$input = [
'first_name' => 'John',
'last_name' => 'Doe',
'email_address' => '[email protected]'
];
$converted = CaseConverter::convertCase($input, new PascalCase);
print_r($converted);
/*
Array
(
[FirstName] => John
[LastName] => Doe
[EmailAddress] => [email protected]
)
*/
use CaseConverter\CaseConverter;
$input = [
'user' => [
'firstName' => 'John',
'lastName' => 'Doe',
'emailAddress' => '[email protected]'
],
'address' => [
'street' => '123 Main St',
'city' => 'New York',
'country' => 'USA'
]
];
$converted = CaseConverter::convertCase($input, new SnakeCase);
print_r($converted);
/*
Array
(
[user] => Array
(
[first_name] => John
[last_name] => Doe
[email_address] => [email protected]
)
[address] => Array
(
[street] => 123 Main St
[city] => New York
[country] => USA
)
)
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.