marcojetson / quark
Another dependency injection container
dev-master
2015-05-30 08:32 UTC
Requires
- php: >=5.6
Requires (Dev)
- codeclimate/php-test-reporter: ^0.1.2
- phpunit/phpunit: 4.6.*
This package is not auto-updated.
Last update: 2025-02-15 19:25:32 UTC
README
Another dependency injection container
Services
Register services using set and providing an identifier and a factory
$application->set('service', function () { return new stdClass(); });
Access the service anywhere in your application
$service = $application->service;
If you want to share the same instance across your application use share
$application->share('service', function () { return new stdClass(); });
You can provide arguments for your services
$application->set('person', function ($name) { $person = new stdClass(); $person->name = $name; return $person; }); $person = $application->person('Marco');