PHP code example of vpg / titon.utility

1. Go to this page and download the library: Download vpg/titon.utility 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/ */

    

vpg / titon.utility example snippets


use Titon\Utility\Inflector;

Inflector::macro('upperCase', function($value) {
    return strtoupper($value);
});

Inflector::upperCase('foo'); // FOO

Titon\Utility\Converter::toArray($xml); // Supports arrays, objects, JSON, XML, serialized

Titon\Utility\Crypt::blowfish('foobar', $salt);

Titon\Utility\Format::phone('1234567890', '(###) ###-####'); // (123) 456-7890

Titon\Utility\Hash::set($array, 'foo.bar', 'baz');

Titon\Utility\Inflector::camelCase('foo bar'); // FooBar

Titon\Utility\Number::bytesTo(1024); // 1KB

Titon\Utility\Path::className('Vendor\Foo\Bar'); // Bar

Titon\Utility\Sanitize::html($data);

Titon\Utility\String::truncate($string);

Titon\Utility\Time::isTomorrow($time);

Titon\Utility\Validate::ext($path, ['gif', 'png', 'jpg']);