php-lab / di
依赖注入容器。
dev-master
2016-03-07 21:19 UTC
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2024-09-22 20:07:22 UTC
README
PhpLab\Di 需要 PHP 7。
用法
use PhpLab\Di\Container; $app = new Container(); $app->pageIndexAction = function (Container $di) { return new \Page\Action\IndexAction($di->pageIndexResponder); }; $app->pageIndexResponder = function (Container $di) { return new \Page\Responder\IndexResponder($di->pageIndexTemplate); }; $app->pageIndexTemplate = function (Container $di) { return new \Page\Template\IndexTemplate($di['path.template']); }; $app['path.root'] = __DIR__ . '/../..'; $app['path.template'] = $app['path.root'] . '/template/site';
许可证
PhpLab\Di 使用 MIT 许可证。