wilderborn/partyline
Composer 安装命令:
composer require wilderborn/partyline
包简介
A Laravel 5 package to output to the console from outside of command classes
README 文档
README
This package allows you to output to the console from outside of command class.
For example, you might have a feature that does the same thing from a command and through the web. Until now, you may have found yourself duplicating code just to be able to output to the console in various places.
With Partyline, you can use output commands within your logic. If it's being run inside the console, you'll see it. Otherwise, nothing will happen.
Usage
In your console command's handle method, bind the command into Partyline using the facade:
public function handle() { \Partyline::bind($this); }
Then in your regular classes, you may call any public Illuminate\Console\Command methods on the Partyline facade, just like you would inside the command class.
\Partyline::info('foo'); // Equivalent to $this->info('foo') within your command.
Facade usage
You can either use the globally aliased facade with a slash:
\Partyline::method();
Or, you can import the facade:
use Wilderborn\Partyline\Facade as Partyline; Partyline::method();
Installation
This package can be installed through Composer.
composer require wilderborn/partyline
For Laravel 5.4 and below, register the service provider and facade:
// config/app.php 'providers' => [ ... Wilderborn\Partyline\ServiceProvider::class, ... ], 'aliases' => [ ... 'Partyline' => Wilderborn\Partyline\Facade::class, ... ]
For Laravel 5.5+, this package will be automatically discovered.
Tips
If you have many commands classes, you may find it tedious to bind into Partyline every time. You may consider an abstract command class and bind inside the run method.
class YourCommand extends AbstractCommand { public function handle() { // } }
class AbstractCommand extends Command { /** * Run the console command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return int */ public function run(InputInterface $input, OutputInterface $output) { \Partyline::bind($this); return parent::run($input, $output); } }
More info on our Statamic blog: https://statamic.com/blog/partyline
wilderborn/partyline 适用场景与选型建议
wilderborn/partyline 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.65M 次下载、GitHub Stars 达 193, 最近一次更新时间为 2017 年 06 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wilderborn/partyline 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wilderborn/partyline 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.65M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 193
- 点击次数: 22
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-01