-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from phar-io/php8
Add PHP8 support
- Loading branch information
Showing
2 changed files
with
56 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,57 @@ | ||
# Composer-Distributor | ||
# Deploying PHAR files via Composer | ||
|
||
The base-code to create a ComposerPlugin that installs PHAR files | ||
instead of the whole source code of a project. | ||
If you have a tool that behaves like a binary and want to distribute this tool as a | ||
PHAR file instead of the source-code, but you don't want to give up the convenience | ||
to install your tool via Composer you can use this library to create a Composer-Plugin | ||
that deals with this in no time. | ||
|
||
You have a tool that behaves like a binary? A tool that can be distributed as | ||
PHAR instead of the source-code? A tool that should install the PHAR via | ||
composer? | ||
## Motivation | ||
|
||
But you don't want to commit your PHAR into your VCS? | ||
Tools like `PHPUnit`, `PHPStan`, `Psalm` and many others should be installed as PHAR to avoid | ||
version conflicts between your dev tools and your own source code. But since so many developers | ||
just want to use `Composer` to install stuff this project was created to simplify the deployment | ||
of a PHAR file via `Composer`. | ||
|
||
Then create and deploy your signed PHAR file and create a composer plugin using | ||
this base-code and distribute your PHAR file via composer. | ||
## Create your own | ||
|
||
## Usage | ||
To create a Composer-Plugin that installs your PHAR files follow these 3 steps. | ||
|
||
Create your own Composer-Plugin via | ||
### Step 1 - Create your Composer-Plugin repository | ||
|
||
```bash | ||
composer create-project phar-io/mediator /path/to/your/directory/ | ||
``` | ||
|
||
Then you can replace the placeholders within `src/Plugin.php` as well as in the | ||
`composer.json` files and submit it to the VCS of your choice and submit the | ||
plugin to packagist.org. | ||
The only thing you have to edit is the `distributor.xml` configuration file. | ||
Just change the `packageName` and `<phar>` configuration and you are good to go. | ||
|
||
The last step is to tag and deploy the plugin each time you tag and deploy your | ||
PHAR file. Use the same tag for the plugin that you use for the PHAR-file to be | ||
able to use composers versioning contraints. | ||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<distributor xmlns="https://phar.io/composer-distributor" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://phar.io/xml/distributor/1.0/schema.xsd" | ||
packageName="yournamespace/pluginname" | ||
keyDirectory="keys"> | ||
|
||
<phar name="pharname" | ||
file="https://github.com/yournamespace/pluginname/releases/download/{{version}}/pharname.phar" | ||
signature="https://github.com/yournamespace/pluginname/releases/download/{{version}}/pharname.phar.asc"/> | ||
|
||
</distributor> | ||
``` | ||
|
||
### Step 2 - Create a Composer package for your plugin on packagist | ||
|
||
Create a git repository for your plugin on the platform of your choosing. Then head over to | ||
packagist.org and set up a Composer package for your plugin. | ||
|
||
Make sure you add the same tags to your plugin repository as on your source code repository. | ||
|
||
### Step 3 - Change your installation instructions | ||
|
||
Now everybody can install your PHAR by running the following command. | ||
|
||
```bash | ||
composer require --dev yournamespace/yourpluginname | ||
``` | ||
|
||
Find more information in the README of the base-plugin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,16 @@ | |
"name": "Andreas Heigl", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name" : "Arne Blankerts", | ||
"email" : "[email protected]", | ||
"role" : "Developer" | ||
}, | ||
{ | ||
"name" : "Sebastian Feldmann", | ||
"email" : "[email protected]", | ||
"role" : "Developer" | ||
} | ||
], | ||
"keywords": [ | ||
|
@@ -43,8 +53,8 @@ | |
"ext-dom": "*", | ||
"ext-libxml": "*", | ||
"composer-plugin-api": "^1.1 || ^2.0", | ||
"phar-io/gnupg": "^0.9", | ||
"phar-io/filesystem": "^0.9" | ||
"phar-io/gnupg": "^1.0", | ||
"phar-io/filesystem": "^2.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.4", | ||
|