|
2 | 2 | [![Software License][ico-license]](LICENSE)
|
3 | 3 | [](https://github.com/renakdup/simple-wordpress-dic/actions/workflows/phpunit.yaml)
|
4 | 4 | [](https://github.com/renakdup/simple-wordpress-dic/actions/workflows/phpstan.yaml)
|
| 5 | +[](https://packagist.org/packages/renakdup/simple-php-dic) |
| 6 | +[](https://packagist.org/packages/renakdup/simple-php-dic) |
5 | 7 |
|
6 | 8 |
|
| 9 | +Simple DI Container with **autowiring** in a single file **with NO dependencies** allows you to easily use it in your PHP applications and especially convenient for **WordPress** plugins and themes. |
7 | 10 |
|
8 |
| -Simple DI Container with **autowiring** in a single file **without dependencies** allows you to easily use it in your PHP applications and especially convenient for **WordPress** plugins and themes. |
9 |
| - |
10 |
| -## Why choose Simple DI Container? |
11 |
| -1. Easy to integrate into your PHP Application or WordPress project, just copy one file. |
12 |
| -2. Simple PHP DI Container hasn't any dependencies on other scripts or libraries. |
| 11 | +## Why choose Simple DI Container |
| 12 | +1. Easy to integrate in your WordPress project - just copy one file or install via Composer. |
| 13 | +2. No dependencies on other scripts or libraries. |
13 | 14 | 3. Supports auto-wiring `__constructor` parameters for classes as well as for scalar types that have default values.
|
14 |
| -4. Supports PHP ^8 and PHP 7.4. |
15 |
| -5. Supports Lazy Load class instantiating. |
16 |
| -6. Allow you following the best practices for developing your code. |
17 |
| -7. Supports PSR11 (read more about below). |
18 |
| -8. No phpcs conflicts. |
| 15 | +4. Supports PHP ^7.4|^8. |
| 16 | +5. Allow you following the best practices for developing your code. |
| 17 | +6. No PHPCS conflicts. |
| 18 | +7. Supports Lazy Load class instantiating. |
| 19 | +8. Lightweight and fast. |
19 | 20 |
|
20 |
| -## How to integrate it in a project? |
| 21 | +## How to install in a project |
21 | 22 |
|
22 |
| -1. Just copy the file `./src/Container.php` to your plugin directory or theme. |
23 |
| -2. Rename `namespace` in the file from `Renakdup\SimpleDIC` to `<Your_Plugin_Name>\SimpleDIC` |
24 |
| -3. Require this file. |
| 23 | +There are several ways, you can choose what you more prefer: |
25 | 24 |
|
26 |
| -## How to use it in code |
| 25 | +### Install via Composer |
| 26 | +```bash |
| 27 | +composer require renakdup/simple-php-dic |
| 28 | +``` |
27 | 29 |
|
28 |
| -### Get started: |
| 30 | +### Copy and paste file |
| 31 | + 1. Just copy the file `./src/Container.php` to your plugin directory or theme. |
| 32 | + 2. Rename `namespace` in the file |
| 33 | + from `Renakdup\SimpleDIC` to `<Your_Plugin_Name>\SimpleDIC` |
| 34 | + 3. Include the file. |
29 | 35 |
|
30 |
| -1. Add file to your application and `include`. |
31 |
| -2. Create a container. |
32 |
| -3. Set a service |
33 |
| -4. Get a service |
34 |
| -5. Use object |
| 36 | +## How to use it |
| 37 | + |
| 38 | +### Get started: |
| 39 | +1. Create container instance. |
| 40 | +2. Set a service |
| 41 | +3. Get a service |
| 42 | +4. Use object |
35 | 43 | ```php
|
36 | 44 | use Renakdup\SimpleDIC\Container;
|
37 | 45 |
|
|
0 commit comments