Skip to content

Commit 509f0f0

Browse files
claurospacearhimede
authored andcommitted
changes from review
Signed-off-by: arhimede <julian@dotkernel.com>
1 parent e9250ee commit 509f0f0

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

docs/book/v5/core-features/dependency-injection.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
# Dependency Injection
22

3-
Dependency Injection is a design pattern used in software development to implement inversion of control or in simple
3+
Dependency injection is a design pattern used in software development to implement inversion of control or in simple
44
terms is the act of providing dependencies for an object during instantiation.
55

6-
In PHP, dependency injection can be implemented in various ways, including through constructor injection,
7-
setter injection, and property injection.
6+
In PHP, dependency injection can be implemented in various ways, including through constructor injection, setter
7+
injection, and property injection.
88

9-
DotKernel API, through it's
10-
[dot-dependency-injection](https://github.com/dotkernel/dot-dependency-injection) package focuses only on constructor
11-
injection.
9+
DotKernel API, through it's [dot-dependency-injection](https://github.com/dotkernel/dot-dependency-injection) package
10+
focuses only on constructor injection.
1211

1312
## Usage
1413

15-
DotKernel API comes out of the box with [dot-dependency-injection](https://github.com/dotkernel/dot-dependency-injection)
16-
package, which provide all we need for injecting dependencies in any object you want.
14+
DotKernel API comes out of the box with
15+
[dot-dependency-injection](https://github.com/dotkernel/dot-dependency-injection)package, which provide all we need for
16+
injecting dependencies in any object you want.
1717

1818
`dot-dependency-injection` determines the dependencies by looking at the `#[Inject]` attribute,
19-
added to the constructor of a class. Dependencies are specified as separate parameters of the `#[Inject]`
20-
attribute.
19+
added to the constructor of a class. Dependencies are specified as separate parameters of the `#[Inject]` attribute.
2120

2221
For our example we will inject a `UserService` and `config` dependencies in a `UseHandler`.
2322

@@ -38,9 +37,11 @@ class UserHandler implements RequestHandlerInterface
3837
}
3938
```
4039

41-
>If your class needs the value of a specific configuration key, you can specify the path using dot notation: `config.example`
40+
> If your class needs the value of a specific configuration key, you can specify the path using dot notation:
41+
> `config.example`
4242
43-
After register the class in the `ConfigProvider`, under `factories`, using `Dot\DependencyInjection\Factory\AttributedServiceFactory::class`
43+
After, register the class in the `ConfigProvider`, under `factories`, using
44+
`Dot\DependencyInjection\Factory\AttributedServiceFactory::class`
4445

4546
```php
4647
public function getDependencies(): array
@@ -53,8 +54,8 @@ public function getDependencies(): array
5354
}
5455
```
5556

56-
That's it, by registering this, when your object will instantiate from the container, it will automatically resolve
57-
the dependencies needed for you object.
57+
That's it. By registering this, when your object will be instantiated from the container, it will automatically have
58+
its dependencies resolved.
5859

59-
>Dependencies injection applies to any object within DotKernel API, for example, you could inject dependencies in
60+
> Dependencies injection applies to any object within DotKernel API, for example, you could inject dependencies in
6061
> a service and so on, just need to register it in the `ConfigProvider`

0 commit comments

Comments
 (0)