diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml deleted file mode 100644 index 1a7aa24..0000000 --- a/.github/workflows/docs-build.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: docs-build - -on: - release: - types: [published] - workflow_dispatch: - -jobs: - build-deploy: - runs-on: ubuntu-latest - steps: - - name: Build Docs - uses: dotkernel/documentation-theme/github-actions/docs@main - env: - DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/OSSMETADATA b/OSSMETADATA index 8bff0a1..b6f4252 100644 --- a/OSSMETADATA +++ b/OSSMETADATA @@ -1 +1 @@ -osslifecycle=maintenance +osslifecycle=archived diff --git a/README.md b/README.md index aeddfee..5ede23c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,16 @@ DotKernel dependency injection service. This package can clean up your code, by getting rid of all the factories you write, sometimes just to inject a dependency or two. +## Version History + +| Branch | PSR-11 | Docblock Comments | OSS Lifecycle | PHP Version | +|--------|----------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| 5.0 | 1 \|\| 2 | Attributes | ![OSS Lifecycle](https://img.shields.io/osslifecycle?file_url=https%3A%2F%2Fgithub.com%2Fdotkernel%2Fdot-annotated-services%2Fblob%2F5.0%2FOSSMETADATA) | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/5.2.0) | +| 4.0 | 1 | Annotations | ![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.4.0) | +| 3.0 | 1 | Annotations | ![OSS Lifecycle](https://img.shields.io/osslifecycle?file_url=https%3A%2F%2Fgithub.com%2Fdotkernel%2Fdot-annotated-services%2Fblob%2F3.0%2FOSSMETADATA) | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/3.2.1) | + +## Badges + ![OSS Lifecycle](https://img.shields.io/osslifecycle?file_url=https%3A%2F%2Fgithub.com%2Fdotkernel%2Fdot-annotated-services%2Fblob%2F5.0%2FOSSMETADATA) ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/5.2.0) diff --git a/SECURITY.md b/SECURITY.md index aabfee3..c237518 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,13 +2,12 @@ ## 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) | -| <= 3.x | :x: | | - +| Version | Supported | PHP Version | +|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| +| 5.0 | ![OSS Lifecycle](https://img.shields.io/osslifecycle?file_url=https%3A%2F%2Fgithub.com%2Fdotkernel%2Fdot-annotated-services%2Fblob%2F5.0%2FOSSMETADATA) | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/5.2.0) | +| 4.0 | ![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.4.0) | +| 3.0 | ![OSS Lifecycle](https://img.shields.io/osslifecycle?file_url=https%3A%2F%2Fgithub.com%2Fdotkernel%2Fdot-annotated-services%2Fblob%2F3.0%2FOSSMETADATA) | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-annotated-services/3.2.1) | +| <= 2.x | :x: | | ## Reporting Potential Security Issues diff --git a/docs/book/index.md b/docs/book/index.md deleted file mode 120000 index fe84005..0000000 --- a/docs/book/index.md +++ /dev/null @@ -1 +0,0 @@ -../../README.md \ No newline at end of file diff --git a/docs/book/v4/cache.md b/docs/book/v4/cache.md deleted file mode 100644 index d8ca4b4..0000000 --- a/docs/book/v4/cache.md +++ /dev/null @@ -1,38 +0,0 @@ -# Caching the annotations - -`dot-annotated-services` reads class annotations using [doctrine/annotations](https://github.com/doctrine/annotations) and caches them using [doctrine/cache](https://github.com/doctrine/cache). - -## 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. -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: - -```php - 'annotations_cache_dir' => __DIR__ . '/../../data/cache/annotations', - 'dependencies' => [ - 'factories' => [ - Dot\AnnotatedServices\Factory\AbstractAnnotatedFactory::CACHE_SERVICE => YourApp\Factory\AnnotationsCacheFactory::class, - ], - ]; -``` - -where `AnnotationsCacheFactory` is a custom factory that needs to return a [Doctrine Cache Driver](https://github.com/doctrine/cache/tree/1.13.x/lib/Doctrine/Common/Cache): - -```php -get('config')['annotations_cache_dir']); - } -} -``` diff --git a/docs/book/v4/configuration.md b/docs/book/v4/configuration.md deleted file mode 100644 index bdebef1..0000000 --- a/docs/book/v4/configuration.md +++ /dev/null @@ -1,5 +0,0 @@ -# Configuration - -After installation, register `dot-annotated-services` in your project by adding the below line to your configuration aggregator (usually: `config/config.php`): - - Dot\AnnotatedServices\ConfigProvider::class, diff --git a/docs/book/v4/factories.md b/docs/book/v4/factories.md deleted file mode 100644 index b360c62..0000000 --- a/docs/book/v4/factories.md +++ /dev/null @@ -1,68 +0,0 @@ -# Factories - -`dot-annotated-services` is based on 3 reusable factories - `AnnotatedRepositoryFactory`, `AnnotatedServiceFactory` and `AnnotatedServiceAbstractFactory` - able to inject any dependency into a class. - -## AttributedRepositoryFactory - -Injects entity repositories into a class. - -### Exceptions thrown - -- `Dot\AnnotatedServices\Exception\RuntimeException` if repository does not exist -- `Dot\AnnotatedServices\Exception\RuntimeException` if repository does not extend `Doctrine\ORM\EntityRepository` -- `Dot\AnnotatedServices\Exception\RuntimeException` if repository does not have `@Entity` annotation -- `Psr\Container\NotFoundExceptionInterface` if `Doctrine\ORM\EntityManagerInterface` does not exist in the service container -- `Psr\Container\ContainerExceptionInterface` if service manager is unable to provide an instance of `Doctrine\ORM\EntityManagerInterface` - -## AttributedServiceFactory - -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. - -### Exceptions thrown - -- `Dot\AnnotatedServices\Exception\RuntimeException` if service does not exist -- `Dot\AnnotatedServices\Exception\RuntimeException` if service does not have `@Inject` annotation on it's constructor -- `ReflectionException` on failure of creating a ReflectionClass of the dependency -- `Psr\Container\NotFoundExceptionInterface` if a dependency does not exist in the service container -- `Psr\Container\ContainerExceptionInterface` if service manager is unable to provide an instance of a dependency - -## AnnotatedServiceAbstractFactory - -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. - -```php - $this->getDependencies(), - ]; - } - - public function getDependencies(): array - { - return [ - 'factories' => [ - YourApp\Repository\ExampleRepository::class => Dot\AnnotatedServices\Factory\AnnotatedRepositoryFactory::class, - ], - ]; - } -} -``` diff --git a/docs/book/v4/factories/service.md b/docs/book/v4/factories/service.md deleted file mode 100644 index d3d9e63..0000000 --- a/docs/book/v4/factories/service.md +++ /dev/null @@ -1,84 +0,0 @@ -# Inject class dependencies - -## Prepare class - -`dot-annotated-services` determines the dependencies by looking at the `@Inject` annotation, added to the constructor of a class. -Dependencies are specified as one parameter, which is an array of FQCNs. - -```php - $this->getDependencies(), - ]; - } - - public function getDependencies(): array - { - return [ - 'factories' => [ - YourApp\Service\Example::class => Dot\AnnotatedServices\Factory\AnnotatedServiceFactory::class, - ], - ]; - } -} -``` diff --git a/docs/book/v4/installation.md b/docs/book/v4/installation.md deleted file mode 100644 index 8d628ea..0000000 --- a/docs/book/v4/installation.md +++ /dev/null @@ -1,5 +0,0 @@ -# Installation - -Install `dotkernel/dot-annotated-services` by executing the following Composer command: - - composer require dotkernel/dot-annotated-services diff --git a/docs/book/v4/overview.md b/docs/book/v4/overview.md deleted file mode 100644 index 801130d..0000000 --- a/docs/book/v4/overview.md +++ /dev/null @@ -1,5 +0,0 @@ -# Overview - -`dot-annotated-services` is DotKernel's dependency injection service. - -By providing reusable factories for service and repository injection, it reduces code complexity in projects. diff --git a/docs/book/v4/usage.md b/docs/book/v4/usage.md deleted file mode 100644 index 3cb7915..0000000 --- a/docs/book/v4/usage.md +++ /dev/null @@ -1,8 +0,0 @@ -# Usage - -Version `4.x` of `dot-annotated-services` is the last version that uses [doctrine/annotations](https://github.com/doctrine/annotations) to parse and inject dependencies. - -You can use it to: - -- [Inject class dependencies](factories/service.md) -- [Inject entity repositories](factories/repository.md) diff --git a/docs/book/v5/configuration.md b/docs/book/v5/configuration.md deleted file mode 100644 index bdebef1..0000000 --- a/docs/book/v5/configuration.md +++ /dev/null @@ -1,5 +0,0 @@ -# Configuration - -After installation, register `dot-annotated-services` in your project by adding the below line to your configuration aggregator (usually: `config/config.php`): - - Dot\AnnotatedServices\ConfigProvider::class, diff --git a/docs/book/v5/factories.md b/docs/book/v5/factories.md deleted file mode 100644 index 5201d32..0000000 --- a/docs/book/v5/factories.md +++ /dev/null @@ -1,30 +0,0 @@ -# Factories - -`dot-annotated-services` is based on 2 reusable factories - `AttributedRepositoryFactory` and `AttributedServiceFactory` - able to inject any dependency into a class. - -## AttributedRepositoryFactory - -Injects entity repositories into a class. - -### Exceptions thrown - -- `Dot\AnnotatedServices\Exception\RuntimeException` if repository does not exist -- `Dot\AnnotatedServices\Exception\RuntimeException` if repository does not extend `Doctrine\ORM\EntityRepository` -- `Dot\AnnotatedServices\Exception\RuntimeException` if repository does not have `#[Entity]` attribute -- `Psr\Container\NotFoundExceptionInterface` if `Doctrine\ORM\EntityManagerInterface` does not exist in the service container -- `Psr\Container\ContainerExceptionInterface` if service manager is unable to provide an instance of `Doctrine\ORM\EntityManagerInterface` - -## AttributedServiceFactory - -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. - -### Exceptions thrown - -- `Dot\AnnotatedServices\Exception\RuntimeException` if service does not exist -- `Dot\AnnotatedServices\Exception\RuntimeException` if service does not have `#[Inject]` attribute on it's constructor -- `Dot\AnnotatedServices\Exception\RuntimeException` if service tries to inject itself recursively -- `Psr\Container\NotFoundExceptionInterface` if a dependency does not exist in the service container -- `Psr\Container\ContainerExceptionInterface` if service manager is unable to provide an instance of a dependency diff --git a/docs/book/v5/factories/repository.md b/docs/book/v5/factories/repository.md deleted file mode 100644 index ba31aee..0000000 --- a/docs/book/v5/factories/repository.md +++ /dev/null @@ -1,55 +0,0 @@ -# Inject entity repositories - -## Prepare repository - -`dot-annotated-services` determines the entity a repository is related to by looking at the `#[Entity]` attribute, added to the repository class. - -```php - $this->getDependencies(), - ]; - } - - public function getDependencies(): array - { - return [ - 'factories' => [ - YourApp\Repository\ExampleRepository::class => Dot\AnnotatedServices\Factory\AttributedRepositoryFactory::class, - ], - ]; - } -} -``` diff --git a/docs/book/v5/factories/service.md b/docs/book/v5/factories/service.md deleted file mode 100644 index c8ad182..0000000 --- a/docs/book/v5/factories/service.md +++ /dev/null @@ -1,80 +0,0 @@ -# Inject class dependencies - -## Prepare class - -`dot-annotated-services` determines the dependencies by looking at the `#[Inject]` attribute, added to the constructor of a class. -Dependencies are specified as separate parameters of the #[Inject] attribute. - -```php - $this->getDependencies(), - ]; - } - - public function getDependencies(): array - { - return [ - 'factories' => [ - YourApp\Service\Example::class => Dot\AnnotatedServices\Factory\AttributedServiceFactory::class, - ], - ]; - } -} -``` diff --git a/docs/book/v5/installation.md b/docs/book/v5/installation.md deleted file mode 100644 index 8d628ea..0000000 --- a/docs/book/v5/installation.md +++ /dev/null @@ -1,5 +0,0 @@ -# Installation - -Install `dotkernel/dot-annotated-services` by executing the following Composer command: - - composer require dotkernel/dot-annotated-services diff --git a/docs/book/v5/overview.md b/docs/book/v5/overview.md deleted file mode 100644 index 06a23f1..0000000 --- a/docs/book/v5/overview.md +++ /dev/null @@ -1,9 +0,0 @@ -# Overview - -`dot-annotated-services` is DotKernel's dependency injection service. - -By providing reusable factories for service and repository injection, it reduces code complexity in projects. - -> `dot-annotated-services` v5 has been abandoned in favor of [dot-dependency-injection](https://github.com/dotkernel/dot-dependency-injection), which uses PHP attributes instead of annotations. -> -> Going forward, if you want to use annotations in your projects, use [dot-annotated-services v4](../v4/overview.md), else use `dot-dependency-injection`. diff --git a/docs/book/v5/usage.md b/docs/book/v5/usage.md deleted file mode 100644 index d2702b4..0000000 --- a/docs/book/v5/usage.md +++ /dev/null @@ -1,8 +0,0 @@ -# Usage - -Starting from version `5.x`, `dot-annotated-services` uses PHP attributes to inject dependencies. - -You can use it to: - -- [Inject class dependencies](factories/service.md) -- [Inject entity repositories](factories/repository.md) diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index d7d4297..0000000 --- a/mkdocs.yml +++ /dev/null @@ -1,34 +0,0 @@ -docs_dir: docs/book -site_dir: docs/html -extra: - project: Packages - current_version: v4 - versions: - - v5 - - v4 -nav: - - Home: index.md - - v5: - - Overview: v5/overview.md - - Installation: v5/installation.md - - Configuration: v5/configuration.md - - Usage: v5/usage.md - - Factories: v5/factories.md - - Reference: - - "Inject class dependencies": v5/factories/service.md - - "Inject entity repositories": v5/factories/repository.md - - v4: - - Overview: v4/overview.md - - Installation: v4/installation.md - - Configuration: v4/configuration.md - - Usage: v4/usage.md - - Factories: v4/factories.md - - Cache: v4/cache.md - - Reference: - - "Inject class dependencies": v4/factories/service.md - - "Inject entity repositories": v4/factories/repository.md -site_name: dot-annotated-services -site_description: "DotKernel's dependency injection service, using PHP attributes" -repo_url: "https://github.com/dotkernel/dot-annotated-services" -plugins: - - search