定制 wilderborn/partyline 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wilderborn/partyline

最新稳定版本:1.0.2

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

统计信息

  • 总下载量: 3.94M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 191
  • 点击次数: 3
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 191
  • Watchers: 4
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固