|
1 | 1 |
|
2 | 2 | # Container, Factories and the dependency injector |
3 | | -PSR Container built for PHP Fuse framework |
| 3 | +PSR Container built for MaplePHP framework |
4 | 4 |
|
5 | 5 | Container, Factories and dependency injectors will help to make your PHP code more maintainable, flexible, and testable by reducing coupling between objects and centralizing the management of dependencies. |
6 | 6 |
|
7 | 7 | ## Container |
8 | 8 | Containers allowing you to easily create and retrieve objects that are needed throughout your application. |
9 | 9 | ```php |
10 | | -use PHPFuse\Container\tests\TestClasses\TestClass; |
| 10 | +use MaplePHP\Container\tests\TestClasses\TestClass; |
11 | 11 |
|
12 | 12 | $container->set("test1", TestClass::class); // Will load TestClass |
13 | 13 | $container->set("test2", TestClass::class, ["Test"]); // Will load TestClass and set argumnet to constructor |
@@ -35,19 +35,19 @@ You can use the **Dependency injector** just like create any other container, as |
35 | 35 | Take a look at this example |
36 | 36 |
|
37 | 37 | ```php |
38 | | -use PHPFuse\Container\tests\TestClasses\TestClass; |
| 38 | +use MaplePHP\Container\tests\TestClasses\TestClass; |
39 | 39 | $container->set("uniqueKey", TestClass:class); |
40 | | -// $container->set("uniqueKey", '\PHPFuse\Container\tests\Controllers\TestController'); // Same as above |
| 40 | +// $container->set("uniqueKey", '\MaplePHP\Container\tests\Controllers\TestController'); // Same as above |
41 | 41 | $testController = $container->get("uniqueKey"); |
42 | 42 | echo $testController->start(); |
43 | 43 |
|
44 | 44 | ``` |
45 | 45 | The above code will load **TestController** and auto initialize the class **Test**. |
46 | 46 |
|
47 | 47 | ```php |
48 | | -namespace PHPFuse\Container\tests\Controllers; |
| 48 | +namespace MaplePHP\Container\tests\Controllers; |
49 | 49 |
|
50 | | -use PHPFuse\Container\tests\TestClasses\Test; |
| 50 | +use MaplePHP\Container\tests\TestClasses\Test; |
51 | 51 |
|
52 | 52 | class TestController { |
53 | 53 |
|
|
0 commit comments