Skip to content

Commit

Permalink
Merge pull request #208 from nicolas-grekas/composer-plugin
Browse files Browse the repository at this point in the history
Add composer plugin to auto-install missing implementations
  • Loading branch information
dbu authored Feb 9, 2023
2 parents c1a1061 + ad9ea26 commit ebf69e0
Show file tree
Hide file tree
Showing 9 changed files with 507 additions and 6 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Plugin
on:
push:
branches:
- master
pull_request:

jobs:
plugin:
name: Plugin test with Composer ${{ matrix.composer }}
runs-on: ubuntu-latest

strategy:
matrix:
include:
- composer: v1
- composer: v2

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
tools: composer:${{ matrix.composer }}

- name: Check Plugin
run: |
mkdir /tmp/plugin
# replace the relative path for the repository url with an absolute path for composer v1 compatibility
jq '.repositories[0].url="'$(pwd)'"' tests/plugin/composer.json > /tmp/plugin/composer.json
cd /tmp/plugin
composer update
composer show http-interop/http-factory-guzzle -q
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Change Log

## 1.15.0 - 2023-01-XX
## 1.15.0 - 2023-02-09

- [#209](https://github.com/php-http/discovery/pull/209) - Add generic `Psr17Factory` class
- [#208](https://github.com/php-http/discovery/pull/208) - Add composer plugin to auto-install missing implementations.
When libraries require an http implementation but no packages providing that implementation is installed in the application, the plugin will automatically install one.
This is only done for libraries that directly require php-http/discovery to avoid unexpected dependency installation.

## 1.14.3 - 2022-07-11

Expand Down
20 changes: 15 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "php-http/discovery",
"description": "Finds installed HTTPlug implementations and PSR-7 message factories",
"description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations",
"type": "composer-plugin",
"license": "MIT",
"keywords": ["http", "discovery", "client", "adapter", "message", "factory", "psr7", "psr17"],
"homepage": "http://php-http.org",
Expand All @@ -10,19 +11,25 @@
"email": "[email protected]"
}
],
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "*",
"psr/http-factory-implementation": "*",
"psr/http-message-implementation": "*"
},
"require": {
"php": "^7.1 || ^8.0"
"php": "^7.1 || ^8.0",
"composer-plugin-api": "^1.0|^2.0"
},
"require-dev": {
"composer/composer": "^1.0.2|^2.0",
"graham-campbell/phpspec-skip-example-extension": "^5.0",
"php-http/httplug": "^1.0 || ^2.0",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^5.1 || ^6.1 || ^7.3",
"symfony/phpunit-bridge": "^6.2"
},
"suggest": {
"php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
},
"autoload": {
"psr-4": {
"Http\\Discovery\\": "src/"
Expand All @@ -40,6 +47,9 @@
],
"test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml"
},
"extra": {
"class": "Http\\Discovery\\Composer\\Plugin"
},
"conflict": {
"nyholm/psr7": "<1.0"
},
Expand Down
Loading

0 comments on commit ebf69e0

Please sign in to comment.