1. Go to this page and download the library: Download gcworld/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/ */
gcworld / container example snippets
use GCWorld\Container\Core\SharedContainer;
$container = SharedContainer::getInstance();
$container->set('configuration', $configuration);
if ($container->has('configuration')) {
$configuration = $container->get('configuration');
}
use Example\Application\Configuration;
use Example\Application\Session;
use GCWorld\Container\Core\SharedContainer;
$container = SharedContainer::getInstance();
if (!$container->has('configuration')) {
$container->set('configuration', new Configuration());
$container->set('session', Session::class.'::getInstance');
}