• Stars
    star
    101
  • Rank 331,048 (Top 7 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple composer script to manage phar files using project composer.json.

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.

fallback-url (optional, default none)

This option is useful if you want to add an extra layer of stability to your daily build processes.

In case the required url is not accessible and a fallback-url is set, tooly uses the fallback url to download the phar file. The fallback url can be a link to a specific version, such as x.y.z, or a link to the latest version for this phar.

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.

More Repositories

1

go-mnd

Magic number detector for Go.
Go
186
star
2

puppet-vagrant-boxes

Build fast vagrant-base-boxes with veewee and puppet for further usage.
Shell
63
star
3

error-log-parser

Simple PHP library to parse Apache or Nginx error-log file entries for further usage.
PHP
21
star
4

puppet-typo3

Work on this repository has moved to move-elevator/puppet-typo3.
Puppet
17
star
5

php-hooks

PhpHooks is a collection of some useful customizable checks that you can use as git pre-commit hook before you commit some changes.
PHP
8
star
6

php-composer-plugin-devenv

Development environment to build Composer plugins.
PHP
7
star
7

docker-alpine-php-nightly

Docker Image to run PHP nightly builds. Currently 8.0.0-dev.
Dockerfile
5
star
8

silex-sitemap-service-provider

Simple sitemap generator provider for Silex.
PHP
5
star
9

speakerdeck_exporter

Unofficial Prometheus Exporter for SpeakerDeck.
Go
5
star
10

puppet-typo3-testbox

Testbox for puppet module typo3.
Puppet
5
star
11

composer-tool-installer-plugin

Install binary project requirements with composer.
PHP
5
star
12

php-repository-starter

My personal starter template for a new PHP project.
4
star
13

php-in-memoriam-extension

My farewell gift for the remaining colleagues at @move-elevator.
C
4
star
14

php-daily-business

My personal list of libraries to solve daily business challenges.
4
star
15

docker-phpstan

Work on this repository has moved to phpstan/docker-image
Makefile
4
star
16

go-jira-prepare-commit-msg

Git hook to add JIRA issue key from branch-name (if it exists) and add it before the commit message.
Go
3
star
17

awesome-dockerized-php-tools

List of awesome Dockerized PHP tools.
3
star
18

silex-doctrine-orm-service-provider

PHP
2
star
19

keynote-defensive-programming

Code snippets for my keynote "Defense programming (with PHP)".
PHP
2
star
20

php-time-conversion

Convert, compare and operate with time in different unit's.
PHP
2
star
21

php-metrics-monitor

You have multiple project metrics and want to see a trend in a single diagram without compare multiple ones? You are right.
PHP
2
star
22

docker-php-test-compilation

Run any checks in various PHP versions.
Shell
1
star
23

ansible-vagrant-boxes

Shell
1
star
24

tommy-muehle

1
star
25

github-counter

PHP
1
star
26

tommy-muehle.io

My personal website.
CSS
1
star
27

jetbrains-color-schemes

My personal color schemes.
1
star
28

php-gpg-verifier

Simple library to verify a file with gpg signature.
PHP
1
star
29

smtp-reader

Go
1
star
30

garvis

Go
1
star
31

phive-composer-plugin-devenv

Development environment for PHIVE's Composer plugin.
1
star
32

keynote-enums-an-introduction

Code snippets for my keynote "Enums - An introduction".
PHP
1
star
33

keynote-why-setters-are-bad

Code snippets for my keynote "Why setters are bad".
PHP
1
star
34

dockerized-php-generator

Go
1
star
35

gearman-monitor-bundle

PHP
1
star
36

tommy-muehle.github.io

My personal blog on Github.io
CSS
1
star
37

homebrew-tap

Ruby
1
star
38

dotfiles

My .dotfiles
Shell
1
star