Download the PHP package timmylindh/laravel-beanstalk-worker without Composer
On this page you can find all versions of the php package timmylindh/laravel-beanstalk-worker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timmylindh/laravel-beanstalk-worker
More information about timmylindh/laravel-beanstalk-worker
Files in timmylindh/laravel-beanstalk-worker
Package laravel-beanstalk-worker
Short Description Provides functionality to utilize Laravel SQS queues and cron jobs in AWS Elastic Beanstalk worker environments
License MIT
Homepage https://github.com/timmylindh/laravel-beanstalk-worker
Informations about the package laravel-beanstalk-worker
laravel-beanstalk-worker
Provides functionality to utilize Laravel SQS queues and cron jobs in AWS Elastic Beanstalk worker environments.
The package supports all Laravel queue and cron features, such as retries, backoff, delay, release, max tries, timeout, etc.
Installation
Requirements:
- Laravel >= 10
- PHP >= 8.1
Install the package:
Publish config (optional):
Publish EB deploy hooks (Amazon Linux 2023):
Automatic setup
Recommended. Set WORKER_TIMEOUT
and let the hooks align all timeouts automatically.
- In Elastic Beanstalk (Worker env), set environment variables:
IS_WORKER=true
WORKER_TIMEOUT=<seconds> (e.g., 300, 900, 1000)
SQS_QUEUE_URL=https://sqs.<region>.amazonaws.com/<account>/<queue>
(*optional)
- Set Worker HTTP path to
/worker/queue
(Configuration → Worker → HTTP path).
Hooks automatically configured from WORKER_TIMEOUT:
- PHP:
max_execution_time = WORKER_TIMEOUT
- PHP‑FPM:
request_terminate_timeout = WORKER_TIMEOUT
- Nginx:
fastcgi_read_timeout = WORKER_TIMEOUT + 30s
- SQS: VisibilityTimeout to
WORKER_TIMEOUT + 100s
- SQSD:
Visibility Timeout = WORKER_TIMEOUT + 100s
- SQSD:
Inactivity Timeout = WORKER_TIMEOUT + 30s
Note that when using the automatic setup, some values that are set through the Elastic Benstalk dashboard will be overwritten on deployment.
*optional: If the SQS_QUEUE_URL
is not provided the VisibilityTimeout
will have to be set manually on the SQS queue.
Cron (optional)
Add a periodic task that runs php artisan schedule:run
via the worker:
-
Create
cron.yaml
in your app root: - Ensure
IS_WORKER=true
. The package exposes/worker/cron
and will run your Laravel scheduler.
Manual setup
Use only if you don’t publish the hooks. Configure to avoid premature redeliveries:
- Set Worker HTTP path to
/worker/queue
. - Set env
IS_WORKER=true
. - SQS
VisibilityTimeout = WORKER_TIMEOUT + ~100s
- SQSD
VisibilityTimeout = WORKER_TIMEOUT + ~100s
- SQSD
InactivityTimeout = WORKER_TIMEOUT + ~30s
- Nginx
fastcgi_read_timeout = WORKER_TIMEOUT + ~30s
- PHP‑FPM
request_terminate_timeout = WORKER_TIMEOUT
- PHP
max_execution_time = WORKER_TIMEOUT
Configuration
config/worker.php
(publish to customize):
Jobs can still set $timeout
and $tries
. Ensure $timeout <= WORKER_TIMEOUT
.
How it works
-
Flow
- aws‑sqsd (EB worker daemon) polls SQS and POSTs messages to your app at
/worker/queue
. - The package deserializes the job and executes it using Laravel’s worker semantics.
- The endpoint always returns HTTP 2xx, so aws‑sqsd deletes the SQS message after delivery.
- aws‑sqsd (EB worker daemon) polls SQS and POSTs messages to your app at
-
Retries and attempts
- On failure, the job is re‑queued via Laravel
release()
with your chosen backoff; the payload carries an incrementedattempts
count. - On the next delivery, total attempts = payload attempts + SQS receive count. Use
$tries
/WORKER_MAX_TRIES
as usual. - Keep jobs idempotent; SQS is at‑least‑once and duplicates can occur.
- On failure, the job is re‑queued via Laravel
-
Timeouts
WORKER_TIMEOUT
defines the max runtime per job at the worker level; job‑level$timeout
may be set but should not exceedWORKER_TIMEOUT
.- The provided hooks align infra timeouts from
WORKER_TIMEOUT
(PHP, PHP‑FPM, Nginx, aws‑sqsd) and set SQS VisibilityTimeout with a small buffer.
- Cron
- If you add
cron.yaml
pointing to/worker/cron
, the worker runsphp artisan schedule:run
on the specified cadence.
- If you add
All versions of laravel-beanstalk-worker with dependencies
aws/aws-sdk-php Version ^3.235.5
illuminate/bus Version ^10.0||^11.0||^12.0
illuminate/contracts Version ^10.0||^11.0||^12.0
illuminate/http Version ^10.0||^11.0||^12.0
illuminate/queue Version ^10.0||^11.0||^12.0
illuminate/support Version ^10.0||^11.0||^12.0