定制 rahul900day/laravel-console-spinner 二次开发

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

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

rahul900day/laravel-console-spinner

最新稳定版本:1.2.0

Composer 安装命令:

composer require rahul900day/laravel-console-spinner

包简介

Laravel Console Spinner is a spinner output for Laravel command line.

README 文档

README

Laravel Console Spinner was created by Rahul Dey. It is just a custom Progress Bar inspired by icanhazstring/symfony-console-spinner.

StyleCI Status Total Downloads Version PHP Version Require

Installation

Requires PHP 7.3+

Via Composer:

composer require rahul900day/laravel-console-spinner

You can publish the config file with:

php artisan vendor:publish --tag=console-spinner-config

This is the contents of the published config file:

return [
    'chars' => ['', '', '', '', '', '', '', ''],
];

Usage

class SimpleLaravelCommand extends Command
{
    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $spinner = $this->spinner($users->count());
        $spinner->setMessage('Loading...');
        $spinner->start();
        
        foreach ($users as $user) {
            // Do your stuff...
            
            $spinner->advance();
        }
        $spinner->finish();
    }
}

The $spinner is compatible with Symfony ProgressBar, so you can run any method of this class.

Or you can also use with withSpinner method by giving an iterable.

$this->withSpinner(User::all(), function($user) {
    // Do your stuff with $user
}, 'Loading...');

Licence

This package is released under the MIT license.

统计信息

  • 总下载量: 117.31k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 76
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 76
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-24