devshop/power-process
Composer 安装命令:
composer require devshop/power-process
包简介
Enhanced Symfony Process component.
README 文档
README
This library provides an upgraded Symfony Process component.
It gives a more user friendly interface for apps that want to show users what processes are running and what their output is.
This library is used by Provision Yaml Tests and will be used in the Provision CLI project.
Symfony 4
The Symfony Process component has different typehints in the parameters of several APIs in Symfony 4 than Symfony 3 does. This is due to the fact that Symfony 4 requires PHP 7.1.3 or later, which supports a number of typehints not permitted in earlier PHP versions. This difference is minor for most clients, but presents problems for code that subclasses Process, as it is not possible to be compatible with both the Symofny 3 and the Symfony 4 typehints at the same time.
| PowerProcess Branch | Symfony Versions | PHP Versions |
|---|---|---|
| master (1.x) | ^2 | ^3 | 5.6+ |
NOTE: A Symfony 4 compatible component will be released at some point.
Big thanks to @g1a and the consolidation team for this block of text, and setting an example of a Process-based component.
See https://github.com/consolidation/site-process/compare/2.x...master as an example on maintaining 2 branches.
Usage
Usage extends the Symfony Process component.
See demo.php for a simple demo:
// Include autoloader include('vendor/autoload.php'); // PowerProcess needs IO. $input = new \Symfony\Component\Console\Input\ArgvInput($argv); $output = new \Symfony\Component\Console\Output\ConsoleOutput(); // Replace Style with your own to change the output style. $io = new DevShop\Component\PowerProcess\PowerProcessStyle($input, $output); // Run any command. $command = 'ls -la'; $process = new DevShop\Component\PowerProcess\PowerProcess($command, $io); $process->run();
Then run the file:
php demo.php
You will see the commands running like so:
Another Example
The file `run' is a wrapper for any command.
Try:
./run ping packagist.org -c 5 ./run git status ./run rm -rf /
Simple.
Functionality
This project is being extracted from Provision CLI. It will grow and change rapidly.
Planned functionality:
- Format output for human readability.
- Automatically pipe output to files, with options for destination path. (This is already done in Provision CLI)
- Allow easily silencing output.
- Add hooks to allow other plugins to react to process events.
devshop/power-process 适用场景与选型建议
devshop/power-process 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.85k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 devshop/power-process 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 devshop/power-process 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-23
