Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/navarr/dependency-annotation
A composer command to determine why the codebase shouldn't be updated to a new version of a package, based on the existence of #[Dependency] attributes
https://github.com/navarr/dependency-annotation
annotations composer composer-plugin dependency-parser hacktoberfest php
Last synced: about 4 hours ago
JSON representation
A composer command to determine why the codebase shouldn't be updated to a new version of a package, based on the existence of #[Dependency] attributes
- Host: GitHub
- URL: https://github.com/navarr/dependency-annotation
- Owner: navarr
- License: mit
- Created: 2020-07-04T23:45:11.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-21T16:39:48.000Z (11 months ago)
- Last Synced: 2024-05-01T19:32:10.203Z (6 months ago)
- Topics: annotations, composer, composer-plugin, dependency-parser, hacktoberfest, php
- Language: PHP
- Homepage:
- Size: 134 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The #[Dependency] Attribute
[![Latest Stable Version](http://poser.pugx.org/navarr/dependency-annotation/v)](https://packagist.org/packages/navarr/dependency-annotation)
[![Total Downloads](http://poser.pugx.org/navarr/dependency-annotation/downloads)](https://packagist.org/packages/navarr/dependency-annotation)
[![Latest Unstable Version](http://poser.pugx.org/navarr/dependency-annotation/v/unstable)](https://packagist.org/packages/navarr/dependency-annotation)
[![License](http://poser.pugx.org/navarr/dependency-annotation/license)](https://packagist.org/packages/navarr/dependency-annotation)
![Tests](https://github.com/navarr/dependency-annotation/actions/workflows/commit.yml/badge.svg)
![Code Coverage](https://codecov.io/gh/navarr/dependency-annotation/branch/main/graph/badge.svg?token=BHTKOZZDR3)
[![Mutation score](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fnavarr%2Fdependency-annotation%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/navarr/dependency-annotation/main)This project supplies a Composer plugin that adds a command (`why-block`) that interprets a PHP `#[Dependency]`
attribute.## How to use the `#[Dependency]` annotation
Simply include a `#[Dependency]` attribute on any attributable target in the following format:
#[Navarr\Attribute\Dependency('package', 'versionConstraint', 'reason')]
This FQN may be imported, in which case you can simply use `#[Dependency(...)]`All fields except the explanation are mandatory. Adding an explanation is _highly recommended_, however.
## How to process reasons not to upgrade a composer dependency
If you are using the `#[Dependency]` annotation thoroughly, and you are having issues updating a composer dependency, you
can use the command `composer why-block composer-package version`This will output a list of files containing a `#[Dependency]` annotation on composer-package with a version-constraint
that cannot be fulfilled by the specified version.## How to install
`composer global require navarr/dependency-annotation`
## Compatibility with v1
For speed, version 2 automatically excludes the legacy `@dependency` annotation in favor of the PHP8 `#[Dependency]`
attribute. While transitioning, you may specify the `-l` or `--include-legacy-annotations` flag to the `why-block`
command to force it to process v1 annotations as well.