PHP code example of phprise / common-value-object
1. Go to this page and download the library: Download phprise/common-value-object 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/ */
phprise / common-value-object example snippets
use Phprise\Common\ValueObject\ArrayObject;
$data = new ArrayObject(['old_key' => 'value']);
// Replace a key
$data->replaceKey('old_key', 'new_key');
echo $data['new_key']; // Outputs: value
use Phprise\Common\ValueObject\StringObject;
$string = new StringObject('hello world');
echo $string->toCamel(); // helloWorld
echo $string->toSnake(); // hello_world
echo $string->toKebab(); // hello-world
echo $string->toPascal(); // HelloWorld
echo $string->toTitle(); // Hello World
echo $string->toUpper(); // HELLO WORLD