mugonat / service-container
This is a simple container service
Installs: 180
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/mugonat/service-container
README
Resolve dependencies like a pro
// Old way, DON'T DO THIS $instance = new User(new Mail(new MailSender())); $instance->sendMail("alex (Using old instantiation)"); // New way, cool way $instance = dependency(User::class); $instance->sendMail("alex (Using dependency helper)");
You can find the full example here
Installation
Inside composer.json add this:
{ // other composer things "minimum-stability": "dev", "prefer-stable": true, "repositories": [ { "type": "vcs", "url": "https://github.com/mugonat-systems/php-service-container" } ] }
Then run
composer require mugonat/service-container