PHP code example of vpg / titon.common

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


class Object extends Titon\Common\Base {
    use Titon\Common\Attachable,    \\ Provides lazy-loaded inner class dependencies
        Titon\Common\Cacheable,     \\ Provides memoization (method caching)
        Titon\Common\Instanceable;  \\ Provides multiton instance support
}

use Titon\Common\Registry;

Registry::register('foo.bar', function() {
    return new Foo\Bar();
});

$foobar = Registry::get('foo.bar');
$foobar = Registry::factory('Foo\Bar'); // by namespace

use Titon\Common\Config;

Config::set('foo.bar', 'baz');
$baz = Config::get('foo.bar');