badtomcat / container
IOC服务容器管理组件
Installs: 44
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: ~5.0
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