life-style-coding / container-pattern
Small library of dependency inversion with container
Requires
- php: >=8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-06-12 19:38:37 UTC
README
⚠️ Huge refacto in progresse the doc is no longer up to date so usage section is not working anymore
🏠 Homepage
Install
composer require life-style-coding/container-pattern
Usage
step 1: To use it you have to provide the use statement for the package at your index.php
use LifeStyleCoding\Container\Container;
step 2: Instanciate the container class
step 3: run the resolve method of the container into a instance variable and pass the class name as argument
step 4: run the execute method of the container and pass the instance variable and the class methods you wish to call as arguments
exemple :
$class = "\\App\\Controller\\HomeController"; $method = "index"; $container = new Container(); $instance = $container->resolve($class); $container->execute($instance, $method);
Next update
Adding a list of objects already instantiated, so as not to have to reinstate them
Handle routing with block comments
Author
👤 Nicolas Montmayeur
- Github: @niko-38500
- LinkedIn: @nicolas-montmayeur-9b7b441ab
Show your support
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator