Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

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.
Annotation parsing can be cached to improve performance.

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

## Documentation

Expand All @@ -13,7 +13,7 @@ Documentation is available at: https://docs.dotkernel.org/dot-annotated-services
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle?file_url=https%3A%2F%2Fgithub.com%2Fdotkernel%2Fdot-annotated-services%2Fblob%2F4.0%2FOSSMETADATA)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.3.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.4.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/network)
Expand Down Expand Up @@ -73,7 +73,7 @@ public function __construct(
The annotation `@Inject` is telling the factory to inject the services between curly braces.
Valid service names should be provided, as registered in the service manager.

To inject an array value from the service manager, you can use dot notation as below,
To inject an array value from the service manager, you can use dot notation as below.

```php
use Dot\AnnotatedServices\Annotation\Inject;
Expand All @@ -87,7 +87,7 @@ which will inject `$container->get('config')['debug'];`

> Even if using dot annotation, the annotated factory will check first if a service name exists with that name.

You can use the inject annotation on setters too, they will be called at creation time and injected with the configured dependencies.
You can use the `@Inject` annotation on setters too, they will be called at creation time and injected with the configured dependencies.

### Using the AnnotatedRepositoryFactory

Expand Down Expand Up @@ -123,7 +123,7 @@ class ExampleRepository extends EntityRepository

Using this approach, no service manager configuration is required. It uses the registered abstract factory to create annotated services.

In order to tell the abstract factory which services are to be created, you need to annotate the service class with the `@Service` annotation.
To tell the abstract factory which services are to be created, you need to annotate the service class with the `@Service` annotation.

```php
use Dot\AnnotatedServices\Annotation\Service;
Expand All @@ -142,7 +142,7 @@ And that's it, you don't need to configure the service manager with this class,
## Cache annotations

This package is built on top of `doctrine/annotation` and `doctrine/cache`.
In order to cache annotations, you should register a service factory at key `AbstractAnnotatedFactory::CACHE_SERVICE` that should return a valid `Doctrine\Common\Cache\Cache` cache driver.
To cache annotations, you should register a service factory at key `AbstractAnnotatedFactory::CACHE_SERVICE` that should return a valid `Doctrine\Common\Cache\Cache` cache driver.
See [Cache Drivers](https://github.com/doctrine/cache/tree/master/lib/Doctrine/Common/Cache) for available implementations offered by doctrine.

Below, we give an example, as defined in our frontend and admin starter applications:
Expand Down
25 changes: 7 additions & 18 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,28 @@

## Supported Versions


| Version | Supported | PHP Version |
|---------|--------------------|------------------------------------------------------------------------------------------------------------------------|
| 5.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/5.2.0) |
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.2.0) |
| 4.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.4.0) |
| <= 3.x | :x: | |


## Reporting Potential Security Issues

If you have encountered a potential security vulnerability in this project,
please report it to us at <security@dotkernel.com>. We will work with you to
verify the vulnerability and patch it.
If you have encountered a potential security vulnerability in this project, please report it to us at <security@dotkernel.com>.
We will work with you to verify the vulnerability and patch it.

When reporting issues, please provide the following information:

- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact

We request that you contact us via the email address above and give the
project contributors a chance to resolve the vulnerability and issue a new
release prior to any public exposure; this helps protect the project's
users, and provides them with a chance to upgrade and/or update in order to
protect their applications.

We request that you contact us via the email address above and give the project contributors a chance to resolve the vulnerability and issue a new release prior to any public exposure;
this helps protect the project's users and provides them with a chance to upgrade and/or update to protect their applications.

## Policy

If we verify a reported security vulnerability, our policy is:

- We will patch the current release branch, as well as the immediate prior minor
release branch.

- After patching the release branches, we will immediately issue new security
fix releases for each patched release branch.
- We will patch the current release branch, as well as the immediate prior minor release branch.
- After patching the release branches, we will immediately issue new security fix releases for each patched release branch.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"service-manager"
],
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"doctrine/annotations": "^1.14.3",
"doctrine/cache": "^1.12.1 || ^2.1.1",
"doctrine/orm" : "^2.20",
Expand Down Expand Up @@ -50,8 +50,8 @@
],
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"static-analysis": "phpstan analyse --memory-limit 1G"
"static-analysis": "phpstan analyse --memory-limit 1G",
"test": "phpunit --colors=always"
},
"config": {
"sort-packages": true,
Expand Down
4 changes: 2 additions & 2 deletions docs/book/v4/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

## Configuration

In order to cache annotations, you should register a service factory at key `AbstractAnnotatedFactory::CACHE_SERVICE` that should return a valid `Doctrine\Common\Cache\Cache` cache driver.
To cache annotations, you should register a service factory at key `AbstractAnnotatedFactory::CACHE_SERVICE` that should return a valid `Doctrine\Common\Cache\Cache` cache driver.
See [Cache Drivers](https://github.com/doctrine/cache/tree/1.13.x/lib/Doctrine/Common/Cache) for available implementations offered by doctrine.

See below an example on how you can configure `dot-annotated-services` to cache annotations.
You can add this configuration values to your application's Doctrine config file:
You can add this configuration value to your application's Doctrine config file:

```php
'annotations_cache_dir' => __DIR__ . '/../../data/cache/annotations',
Expand Down
6 changes: 3 additions & 3 deletions docs/book/v4/factories.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Factories

`dot-annotated-services` is based on 3 reusable factories - `AnnotatedRepositoryFactory`, `AnnotatedServiceFactory` and `AnnotatedServiceAbstractFactory` - able to inject any dependency into a class.
`dot-annotated-services` is based on three reusable factories - `AnnotatedRepositoryFactory`, `AnnotatedServiceFactory` and `AnnotatedServiceAbstractFactory` - able to inject any dependency into a class.

## AttributedRepositoryFactory

Expand All @@ -21,7 +21,7 @@ Injects class dependencies into classes.
If a dependency is specified using the dot notation, `AttributedServiceFactory` will try to load a service having that specific alias.
If it does not find one, it will try to load the dependency as a config tree, checking each segment if it's available in the service container.

You can use the inject annotation on setters too, they will be called at creation time and injected with the configured dependencies.
You can use the `@Inject` annotation on setters too, they will be called at creation time and injected with the configured dependencies.

### Exceptions thrown

Expand All @@ -35,7 +35,7 @@ You can use the inject annotation on setters too, they will be called at creatio

Using this approach, no service manager configuration is required. It uses the registered abstract factory to create annotated services.

In order to tell the abstract factory which services are to be created, you need to annotate the service class with the `@Service` annotation.
To tell the abstract factory which services are to be created, you need to annotate the service class with the `@Service` annotation.

```php
<?php
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v4/factories/repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Open the ConfigProvider of the module where your repository resides.

Add a new entry under `factories`, where the key is your repository FQCN and the value is `Dot\AnnotatedServices\Factory\AnnotatedRepositoryFactory::class`.

See below example for a better understanding of the file structure.
See the below example for a better understanding of the file structure.

```php
<?php
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v4/factories/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Open the ConfigProvider of the module where your class resides.

Add a new entry under `factories`, where the key is your class FQCN and the value is `Dot\AnnotatedServices\Factory\AnnotatedServiceFactory::class`.

See below example for a better understanding of the file structure.
See the below example for a better understanding of the file structure.

```php
<?php
Expand Down
2 changes: 1 addition & 1 deletion docs/book/v4/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ By providing reusable factories for service and repository injection, it reduces
## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle?file_url=https%3A%2F%2Fgithub.com%2Fdotkernel%2Fdot-annotated-services%2Fblob%2F4.0%2FOSSMETADATA)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.3.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/4.4.0)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-annotated-services)](https://github.com/dotkernel/dot-annotated-services/network)
Expand Down
7 changes: 0 additions & 7 deletions docs/book/v5/configuration.md

This file was deleted.

30 changes: 0 additions & 30 deletions docs/book/v5/factories.md

This file was deleted.

55 changes: 0 additions & 55 deletions docs/book/v5/factories/repository.md

This file was deleted.

80 changes: 0 additions & 80 deletions docs/book/v5/factories/service.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/book/v5/installation.md

This file was deleted.

Loading