badtomcat/container

IOC服务容器管理组件

v0.0.1 2017-12-20 10:16 UTC

This package is not auto-updated.

Last update: 2025-06-08 07:07:44 UTC


README

IOC服务容器管理组件

composer require badtomcat/container

$test = new \Badtomcat\Container();
$test->bind("foo",function (cls $ins)
{
    return $ins;
});
$this->assertEquals('foo',$test->make('foo')->bar);
$test->instance("value",123);
$this->assertEquals(123,$test->make('value'));
$this->assertTrue($test->bound("foo"));
$test->bind("bar",cls::class);
$this->assertInstanceOf(cls::class,$test->make("bar"));

[] 操作符执行的是make和bind