diff --git a/README.md b/README.md index 415b921..a7954df 100644 --- a/README.md +++ b/README.md @@ -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 `` 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 + + + + + + +``` + +### 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. diff --git a/composer.json b/composer.json index b60b564..59f0599 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,16 @@ "name": "Andreas Heigl", "email": "andreas@heigl.org", "role": "Developer" + }, + { + "name" : "Arne Blankerts", + "email" : "arne@blankerts.de", + "role" : "Developer" + }, + { + "name" : "Sebastian Feldmann", + "email" : "sf@sebastian-feldmann.info", + "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",