badtomcat / container
IOC服务容器管理组件
v0.0.1
2017-12-20 10:16 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2024-09-29 03:41:53 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