Skip to content

Commit 75a7f24

Browse files
committed
Updated readme
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
1 parent 43adf10 commit 75a7f24

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,41 @@
11
# dot-annotated-services
22

3-
DotKernel component used to create services through [Laminas Service Manager](https://github.com/laminas/laminas-servicemanager) and inject them with dependencies just using method annotations. It can also create services without the need to write factories. Annotation parsing can be cached, to improve performance.
3+
DotKernel dependency injection service.
44

55
This package can clean up your code, by getting rid of all the factories you write, sometimes just to inject a dependency or two.
66

77
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-annotated-services)
8-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.1.7)
8+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/5.0.0)
99

1010
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/issues)
1111
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/network)
1212
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/stargazers)
13-
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/blob/4.0/LICENSE.md)
13+
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/blob/5.0/LICENSE.md)
1414

15-
[![Build Static](https://github.com/dotkernel/dot-annotated-services/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-annotated-services/actions/workflows/static-analysis.yml)
15+
[![Build Static](https://github.com/dotkernel/dot-annotated-services/actions/workflows/static-analysis.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-annotated-services/actions/workflows/static-analysis.yml)
1616
[![codecov](https://codecov.io/gh/dotkernel/dot-annotated-services/graph/badge.svg?token=ZBZDEA3LY8)](https://codecov.io/gh/dotkernel/dot-annotated-services)
1717

1818
[![SymfonyInsight](https://insight.symfony.com/projects/a0d7016e-fc3f-46b8-9b36-571ff060d744/big.svg)](https://insight.symfony.com/projects/a0d7016e-fc3f-46b8-9b36-571ff060d744)
1919

2020

2121
## Installation
2222

23-
Run the following command in your project directory
23+
Install `dot-annotated-services` by running the following command in your project directory:
2424

2525
composer require dotkernel/dot-annotated-services
2626

2727

28-
After installing, add the `ConfigProvider` class to your configuration aggregate, usually: `config/config.php`
28+
After installing, register `dot-annotated-services` in your project by adding the below line to your configuration aggregate (usually: `config/config.php`):
29+
30+
Dot\AnnotatedServices\ConfigProvider::class,
31+
2932

3033
## Usage
3134

3235
### Using the AnnotatedServiceFactory
3336

34-
You can register services in the service manager using `AnnotatedServiceFactory` as below:
37+
You can register services in the service manager using `AnnotatedServiceFactory` as seen in the below example:
38+
3539
```php
3640
return [
3741
'factories' => [
@@ -40,10 +44,12 @@ return [
4044
];
4145
```
4246

47+
4348
### NOTE
4449
> You can use only the fully qualified class name as the service key
4550
4651
The next step is to add the `#[Inject]` attribute to the service constructor with the service FQCNs to inject:
52+
4753
```php
4854
use Dot\AnnotatedServices\Attribute\Inject;
4955

@@ -64,6 +70,7 @@ The `#[Inject]` attribute is telling `AnnotatedServiceFactory` to inject the ser
6470
Valid service names should be provided, as registered in the service manager.
6571

6672
To inject an array value from the service manager, you can use dot notation as below
73+
6774
```php
6875
use Dot\AnnotatedServices\Attribute\Inject;
6976

@@ -88,7 +95,7 @@ return [
8895
];
8996
```
9097

91-
The next step is to add the `#[Entity]` annotation in the repository class.
98+
The next step is to add the `#[Entity]` attribute in the repository class.
9299

93100
The `name` field has to be the fully qualified class name.
94101

0 commit comments

Comments
 (0)