PHP code example of touta / nasc-di
1. Go to this page and download the library: Download touta/nasc-di 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/ */
touta / nasc-di example snippets
use Touta\Nasc\Container;
$container = Container::create()
->bind(LoggerInterface::class, fn() => new FileLogger('/tmp/app.log'))
->bind('db.host', fn() => 'localhost');
$logger = $container->resolve(LoggerInterface::class); // Success(FileLogger)