PHP code example of osflab / container

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

    

osflab / container example snippets


$cache = \Osf\Container\OsfContainer::getCache();

use Osf\Container\AbstractContainer;

class MyContainer extends AbstractContainer
{
    /**
     * Build and get on-demand \My\Class instance(s)
     * @return \My\Class
     */
    public static function getMyClass(): \My\Class
    {
        return self::buildObject('\My\Class');
    }
}