aaronfrancis/enqueue
Composer 安装命令:
composer require aaronfrancis/enqueue
包简介
Declarative job enqueueing with schedule-aware dispatch for Laravel
README 文档
README
Declarative job enqueueing with schedule-aware dispatch for Laravel.
Jobs often need to dispatch themselves on a schedule—syncing data every hour, processing uploads every few minutes, sending reports on weekdays. Normally this means scattering scheduling logic across routes/console.php while the job sits elsewhere, or writing awkward wrapper commands.
Enqueue lets the job own its entire lifecycle. Each job declares how to enqueue itself (maybe one instance per warehouse, or one per pending upload) and optionally when (hourly, weekdays, or custom logic). Run jobs:enqueue every minute and each job takes care of the rest.
Installation
composer require aaronfrancis/enqueue
Usage
Implement the Enqueueable interface on any job:
<?php namespace App\Jobs; use AaronFrancis\Enqueue\Contracts\Enqueueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Queue\Queueable; class SyncInventory implements ShouldQueue, Enqueueable { use Queueable; public function __construct(public int $warehouseId) {} public function handle(): void { // Sync inventory for this warehouse... } public static function enqueue(): void { Warehouse::all()->each(function ($warehouse) { dispatch(new static($warehouse->id)); }); } }
Schedule the command to run every minute:
// routes/console.php Schedule::command('jobs:enqueue')->everyMinute();
Controlling When Jobs Enqueue
Add a shouldEnqueue() method to control timing:
use Illuminate\Console\Scheduling\CallbackEvent; public static function shouldEnqueue(CallbackEvent $event): CallbackEvent { return $event->hourly()->weekdays(); }
Or return a boolean for custom logic:
public static function shouldEnqueue(CallbackEvent $event): bool { return Cache::get('sync_enabled', true); }
Preview Mode
See what would be enqueued without dispatching:
php artisan jobs:enqueue --pretend
Requirements
- PHP 8.2+
- Laravel 10, 11, or 12.24+
License
MIT
aaronfrancis/enqueue 适用场景与选型建议
aaronfrancis/enqueue 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 12 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「laravel」 「jobs」 「scheduling」 「enqueue」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aaronfrancis/enqueue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aaronfrancis/enqueue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aaronfrancis/enqueue 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
This module enables subscription to latest jobs by email
Super-simple, minimum abstraction Lever DATA API v1 wrapper in PHP with support for Laravel.
Message queue statistics for OroPlatform
Redis backed library for creating background jobs and processing them later.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-28