All Projects → tommy-muehle → Tooly Composer Script

tommy-muehle / Tooly Composer Script

Licence: mit
Simple composer script to manage phar files using project composer.json.

Projects that are alternatives of or similar to Tooly Composer Script

Pharbuilder
Create Phar of Composer based PHP application
Stars: ✭ 122 (+40.23%)
Mutual labels:  phar, composer
comphar
Pack all composer dependencies into a single phar file.
Stars: ✭ 67 (-22.99%)
Mutual labels:  composer, phar
Rtorrent Cleaner
🧹 rtorrent-cleaner is a tool to clean up unnecessary files in rtorrent
Stars: ✭ 36 (-58.62%)
Mutual labels:  phar, composer
Formula Parser
Parsing and evaluating mathematical formulas given as strings.
Stars: ✭ 62 (-28.74%)
Mutual labels:  composer
Pusher Http Php
PHP library for interacting with the Pusher Channels HTTP API
Stars: ✭ 1,136 (+1205.75%)
Mutual labels:  composer
Phpari
A Class Library enabling Asterisk ARI functionality for PHP
Stars: ✭ 80 (-8.05%)
Mutual labels:  composer
Crap
Composer Require Aliased Packages: define aliases for your favorite Composer packages.
Stars: ✭ 86 (-1.15%)
Mutual labels:  composer
Deb Dev Machine
Quickly install common Developer tools, IDE's & Services on Debian 9
Stars: ✭ 63 (-27.59%)
Mutual labels:  composer
Direct Upload
Composer Package to Direct Upload to S3
Stars: ✭ 84 (-3.45%)
Mutual labels:  composer
Chinese Typesetting
📄 中文排版 Composer 包
Stars: ✭ 79 (-9.2%)
Mutual labels:  composer
Array group by
A PHP function that groups an array by a key or set of keys shared between all array members.
Stars: ✭ 77 (-11.49%)
Mutual labels:  composer
Designpattern
设计模式
Stars: ✭ 66 (-24.14%)
Mutual labels:  composer
Mix Phar Skeleton
Phar command line program development skeleton
Stars: ✭ 81 (-6.9%)
Mutual labels:  phar
Conductor
Conductor makes it easy to mange multiple composer packages within a single source repository
Stars: ✭ 64 (-26.44%)
Mutual labels:  composer
Easy Extends
一个简单快速安装PHP扩展的程序--最简单的方法就是使用Linux
Stars: ✭ 85 (-2.3%)
Mutual labels:  composer
Scriptsdev
Scripts-dev directive for composer
Stars: ✭ 63 (-27.59%)
Mutual labels:  composer
Project
⭐️ Antares Project Application Skeleton. This is the very first place you should start. It allows you to create a brand new awesome project in easy few steps.
Stars: ✭ 84 (-3.45%)
Mutual labels:  composer
Composer Tools
⚠️ ⚠️ ⚠️ Hyperledger Composer has been deprecated ⚠️ ⚠️ ⚠️
Stars: ✭ 75 (-13.79%)
Mutual labels:  composer
Html Compress Twig
Twig extension for compressing HTML and inline CSS/JS using WyriHaximus/HtmlCompress
Stars: ✭ 72 (-17.24%)
Mutual labels:  composer
Laravel Sitemap
Laravelium Sitemap generator for Laravel.
Stars: ✭ 1,231 (+1314.94%)
Mutual labels:  composer

tooly-composer-script

Minimum PHP Version Latest Stable Version Total Downloads Build Status Build status SensioLabsInsight License Gitter

With tooly composer-script you can version needed PHAR files in your project's composer.json without adding them directly to a VCS,

  • to save disk space at vcs repository
  • to be sure that all developers in your project get the required toolchain
  • to prepare a CI/CD System
  • (optional) to automatically check the GPG signature verification for each tool

Every PHAR file will be saved in the composer binary directory.

Example

An real example can be found here.

Requirements

  • PHP >= 5.6
  • Composer

Install

To use the script execute the following command:

composer require --dev tm/tooly-composer-script

Then add the script in the composer.json under "scripts" with the event names you want to trigger. For example:

...
"scripts": {
    "post-install-cmd": "Tooly\\ScriptHandler::installPharTools",
    "post-update-cmd": "Tooly\\ScriptHandler::installPharTools"
  },
...

Look here for more informations about composer events.

Sample usage

The composer.json scheme has a part "extra" which is used for the script. Its described here.

In this part you can add your needed phar tools under the key "tools".

...
"extra": {
    ...
    "tools": {
      "phpunit": {
        "url": "https://phar.phpunit.de/phpunit-5.5.0.phar",
        "sign-url": "https://phar.phpunit.de/phpunit-5.5.0.phar.asc"
      },
      "phpcpd": {
        "url": "https://phar.phpunit.de/phpcpd-2.0.4.phar",
        "only-dev": true,
        "rename": true
      },
      "security-checker": {
        "url": "http://get.sensiolabs.org/security-checker.phar",
        "force-replace": true
      },
    }
    ...
  }
...

Parameters

url (required)

After you add the name of the tool as key, you need only one further parameter. The "url". The url can be a link to a specific version, such as x.y.z, or a link to the latest version for this phar.

rename (optional, default false)

Rename the downloaded tool to the name that is used as key.

sign-url (optional, default none)

If this parameter is set tooly checks if the PHAR file in url has a valid signature by comparing signature in sign-url.

This option is useful if you want to be sure that the tool is from the expected author.

Note: For the check you need a further requirement and a GPG binary in your $PATH variable.

You can add the requirement with this command: composer require tm/gpg-verifier

This check often fails if you dont has the public key from the tool author in your GPG keychain.

force-replace (optional, default false)

Every time you update or install with composer the phar tools are checked. You are asked if you want to overwrite the existing phar if the remote and local phar has not the same checksum.

Except you set this parameter.

This option is useful if you has a link to the latest version of a tool and always want a replacement. Or you run composer in non-interactive mode (for example in a CI system) and want a replacement.

But is also useful if some require-dev library has one of the tools as own requirement.

only-dev (optional, default true)

This parameter means that this phar is only needed in developing mode. So the command composer [install|update] --no-dev ignores this phar tool.

Note: Therefore tooly must be a no-dev requirement

A note to PhpStorm or other IDE users

To furthermore have auto-suggestion you should set the "include_path" option in the project. PhpStorm setting

Contributing

Please refer to CONTRIBUTING.md for information on how to contribute.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].