PHP code example of mooti / container
1. Go to this page and download the library: Download mooti/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/ */
mooti / container example snippets
use Mooti\Container\ContainerAware;
class ServiceProvider implements ServiceProviderInterface
{
public function getServices()
{
return [
'logger' => function () { return new Logger();},
'message' => 'Hello World'},
];
}
}
use Mooti\Container\ContainerAware;
class App
{
use ContainerAware;
public function run()
{
$config = $this->get('config');
$message = $this->get('message');
$logger->alert($message);
}
}