mugonat / service-container
This is a simple container service
1.0.1
2025-02-16 20:56 UTC
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