定制 fnematov/laravel-scheduler-attribute 二次开发

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

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

fnematov/laravel-scheduler-attribute

最新稳定版本:1.0.0

Composer 安装命令:

composer require fnematov/laravel-scheduler-attribute

包简介

Laravel schedule registerer by attributes

README 文档

README

The Laravel Scheduler Attribute package revolutionizes the way you schedule tasks in your Laravel applications. Utilizing the power of PHP 8 attributes, this package allows developers to declaratively schedule tasks with minimal setup, directly within class methods, enhancing the maintainability and clarity of your codebase.

Features

  • Declarative Scheduling: Easily schedule tasks within your service classes using PHP 8 attributes.
  • Flexible Timing: Supports both cron expressions and Laravel's built-in scheduling methods for comprehensive control over task timing.
  • Clean Architecture: Keep your scheduling logic close to the related business logic for better cohesion.
  • Automatic Discovery: Automatically discovers and registers scheduled tasks, simplifying the scheduling setup process.

Installation

Install the package via Composer:

composer require fnematoc/laravel-scheduler-attribute

Usage

To schedule a task, simply add the #[ArtisanScheduler] attribute to the method you want to schedule. You can then specify the timing of the task using a cron expression or one of Laravel's built-in scheduling methods.

use Fnematov\LaravelSchedulerAttribute\ArtisanScheduler;

class ReportService
{
    #[ArtisanScheduler(name: 'report:daily', schedule: 'daily')]
    public function generateDailyReport()
    {
        // Your task logic here
    }
}

This example schedules the generateDailyReport method to run daily.

Contributing

No additional configuration is required to use this package.

Contributing

Contributions are welcome and will be fully credited. Please submit pull requests to the GitHub repository.

Support

If you encounter any problems, please submit an issue on our GitHub page.

License

The Laravel Scheduler Attribute is open-sourced software licensed under the MIT LICENCE.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

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