lumphp / laravel-queue
Illuminate 队列包。
v8.36.2
2021-09-20 22:46 UTC
Requires
- php: ^7.3|^8.0
- ext-json: *
- lumphp/laravel-collections: ^8.0
- lumphp/laravel-console: ^8.0
- lumphp/laravel-container: ^8.0
- lumphp/laravel-contracts: ^8.0
- lumphp/laravel-database: ^8.0
- lumphp/laravel-filesystem: ^8.0
- lumphp/laravel-pipeline: ^8.0
- lumphp/laravel-support: ^8.0
- opis/closure: ^3.6
- ramsey/uuid: ^4.0
- symfony/process: ^5.1.4
Suggests
- ext-pcntl: Required to use all features of the queue worker.
- ext-posix: Required to use all features of the queue worker.
- aws/aws-sdk-php: Required to use the SQS queue driver and DynamoDb failed job storage (^3.189.0).
- lumphp/laravel-redis: Required to use the Redis queue driver (^8.0).
- pda/pheanstalk: Required to use the Beanstalk queue driver (^4.0).
This package is auto-updated.
Last update: 2024-09-21 06:07:52 UTC
README
Laravel 队列组件提供了一个统一 API,支持多种不同的队列服务。队列允许您将耗时任务(如发送电子邮件)的处理推迟到稍后时间,从而大幅加快应用程序的 Web 请求速度。
使用说明
首先,创建一个新的 Capsule
管理器实例。类似于为 Eloquent ORM 提供的 "Capsule",队列 Capsule 的目的是让在 Laravel 框架外使用库的配置尽可能简单。
use Illuminate\Queue\Capsule\Manager as Queue; $queue = new Queue; $queue->addConnection([ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', ]); // Make this Capsule instance available globally via static methods... (optional) $queue->setAsGlobal();
一旦注册了 Capsule 实例,您可以这样使用它
// As an instance... $queue->push('SendEmail', ['message' => $message]); // If setAsGlobal has been called... Queue::push('SendEmail', ['message' => $message]);
有关使用队列的更多文档,请参阅 Laravel 框架文档。