定制 tkachikov/chronos 二次开发

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

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

tkachikov/chronos

最新稳定版本:1.8.6

Composer 安装命令:

composer require tkachikov/chronos

包简介

Settings commands for Laravel Scheduling

README 文档

README

Logo

Packagist Version PHP from Packagist Laravel 12.x Laravel 11.x Laravel 10.x Laravel 9.x License: MIT

GitHub stars GitHub issues GitHub last commit Tests

This package for setting commands in schedule.

Installation

Require this package with composer using the following command

composer require tkachikov/chronos

Run Chronos command for install:

php artisan chronos:install

Authorization

In defaults pages open for all users and also without auth middleware.

For open setting pages for authenticated users need uncommented 'auth' middleware in config chronos.php:

return [
    'domain' => env('CHRONOS_DOMAIN'),

    'middlewares' => [
        'web',
        'auth',
        // 'Tkachikov\Chronos\Http\Middleware\Authorize',
    ],
];

For authorization in production uncommented Chronos auth in config chronos.php and set statements in app/Providers/ChronosServiceProvider:

return [
    'domain' => env('CHRONOS_DOMAIN'),

    'middlewares' => [
        'web',
        'auth',
        'Tkachikov\Chronos\Http\Middleware\Authorize',
    ],
];
// ...
class ChronosServiceProvider extends ChronosApplicationServiceProvider
{
    // ...
    protected function gate(): void
    {
        Gate::define('viewChronos', function ($user) {
            return $user->hasRole('admin');
        });
    }
}

Usage

Visit route /chronos, example: localhost:8000/chronos

For testing

Open chronos:test command: Open test

Run chronos:test command from queue and reload page: Run test

Run chronos:test command in real time. Out messages pushing in custom terminal: Run test

Run attributes

If you need off run command from Chronos dashboard (notRunInManual) or schedules (notRunInSchedule) set in ChronosCommand attribute:

// ...
use Tkachikov\Chronos\Attributes\ChronosCommand;

#[ChronosCommand(
    notRunInManual: false,
    notRunInSchedule: true,
)]
class TestCommand extends Command
{
    // ...
}

Logging and states

For logging command messages and set status added trait ChronosRunnerTrait:

// ...
class TestCommand extends Command
{
    use ChronosRunnerTrait;
    // ...
}

Create schedules

Open your command and set params for it in Create schedule and save. Create schedule

For off command click button edit, check to off Run and save: Off schedule

Group name

In default base class name directory for group name.
You must be setting property group in ChronosCommand attribute. Example:

// ...
use Tkachikov\Chronos\Attributes\ChronosCommand;

#[ChronosCommand(
    group: 'MyGroup',
)]
class TestCommand extends Command
{
    // ...
}

Statistics

For calculate statistics run commands you must create schedule for chronos:update-metrics

License

This package is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 2.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-26