tm/tooly-composer-script
Composer 安装命令:
composer require tm/tooly-composer-script
包简介
Simple composer script to manage phar files.
README 文档
README
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.

Contributing
Please refer to CONTRIBUTING.md for information on how to contribute.
tm/tooly-composer-script 适用场景与选型建议
tm/tooly-composer-script 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 284.64k 次下载、GitHub Stars 达 103, 最近一次更新时间为 2016 年 07 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「composer」 「phar」 「composer-script」 「phar-management」 「composer-phar」 「phar-handling」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tm/tooly-composer-script 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tm/tooly-composer-script 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tm/tooly-composer-script 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Extractor project for php
Freeze versions of your composer's dependencies.
This composer plugin enables installation of GravityForms WordPress plugin and its addons.
Make all your composer's dependencies stable.
HiDev plugin for Box PHAR builder
统计信息
- 总下载量: 284.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 103
- 点击次数: 23
- 依赖项目数: 36
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-01