PHP code example of phpfox / container
1. Go to this page and download the library: Download phpfox/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/ */
phpfox / container example snippets
$container = Container::getInstance();
$container->bind(
abstract: Abstract::class,
concrete: Concrete::class,
shared: false, // defaults to false - true turns this into a singleton.
);
/**
* @var bool
*/
$exists = $container->has(
id: Abstract::class,
);
/**
* @var Concrete
*/
$concrete = $container->make(
abstract: Abstract::class,
);