mrjulio/rapture-container

Rapture 容器组件

v1.0.1 2017-11-18 19:10 UTC

This package is not auto-updated.

Last update: 2024-09-21 15:22:26 UTC


README

PhpVersion License

PHP 简单依赖注入容器,使用反射。

要求

  • PHP v5.4
  • php-pcre

安装

composer require mrjulio/rapture-container

快速开始

$container = Container::instance('namespace'); // optional namespace

// store
$container['request'] = Request::fromGlobals();

// fetch
$container['request']->getUri()->getPath();

// reflection
Container::instance()['\Demo\User']; // runs reflection and caches result

// no reflection on 2nd run
Container::instance()->getNew('\Demo\User'); // get a new instance

关于

作者

Iulian N. rapture@iuliann.ro

测试

cd ./test && phpunit

许可

Rapture PHP 容器遵循 MIT 许可证 - 有关详细信息,请参阅 LICENSE 文件。