life-style-coding/container-pattern

Small library of dependency inversion with container

1.1.1 2023-01-12 19:13 UTC

This package is auto-updated.

Last update: 2025-06-12 19:38:37 UTC


README

Version License: MIT

⚠️ 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

Show your support

Give a ⭐️ if this project helped you!

This README was generated with ❤️ by readme-md-generator