PHP code example of lion / dependency-injection
1. Go to this page and download the library: Download lion/dependency-injection 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/ */
lion / dependency-injection example snippets
declare(strict_types=1);
ontroller;
use Lion\Dependency\Injection\Container;
$container = new Container();
/** @var UsersController $usersController */
$usersController = $container->resolve(UsersController::class);
$response = $container->callMethod($usersController, 'createUsers');
var_dump($response);
declare(strict_types=1);
ontroller;
use Lion\Dependency\Injection\Container;
$response = (new Container())
->callCallback(function (UsersController $usersController) {
return $usersController->createUsers();
});
var_dump($response);