gidato/laravel-console-output
Composer 安装命令:
composer require gidato/laravel-console-output
包简介
Extensions to catch the output from console commands
README 文档
README
This provides an extensions to the console commands, to allow other commands to be called, but the output to be collected rather than printed to the screen.
As the normal output converts the output to a string, this allows objects to returned provided they have the __toString() method
Installation
composer require gidato/laravel-console-output
Example Use
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Gidato\Console\Commands\Concerns\CallsCommandsAndCollectsOutput;
class MyCommand extends Command
{
\\ include the trait
use CallsCommandsAndCollectsOutput;
.
.
.
public function handle()
{
$this->callAndCollect($response, 'another:command');
$lines = $response->getLines();
$this->callSilentAndCollect($response, 'another:command');
$lines = $response->getLines();
}
}
In each of these call commands, the response from the underlying command is returned, and can be checked.
The output can then be retrieved from the response by using the getLines() method.
License
This software is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-02-06