cachewerk/bref-laravel-bridge
Run Laravel on AWS Lambda with Bref. This bridge connects Laravel's HTTP kernel, queue workers, scheduler, and filesystem to Bref's serverless runtime, so you can deploy a familiar Laravel app without managing servers. Includes sensible defaults for serverless storage, logging, and configuration.
composer require cachewerk/bref-laravel-bridge. You need bref/bref and a Laravel app already in place.serverless.yml:
handler: Bref\Laravel\Handler with a Bref PHP-FPM runtime.config/queue.php and job classes drive behavior.serverless.yml / SSM: APP_ENV, APP_KEY, APP_DEBUG=false, LOG_CHANNEL=stderr, CACHE_DRIVER, SESSION_DRIVER, QUEUE_CONNECTION=sqs, AWS_REGION.serverless deploy, then hit the API Gateway URL. For queues, push a job and check CloudWatch logs plus SQS metrics.failed() methods) apply without custom handler code.Bref\Laravel\Handler → Laravel kernel. Keep the handler thin; use middleware as usual.dispatch(new Job)). Because v0.3.0 uses Laravel's native queue handler, the worker honors $tries, $timeout, $backoff, retryUntil(), and queue events exactly as in a traditional worker.php artisan schedule:run (via the bridge's console handler or a dedicated function). Keep schedule definitions in app/Console/Kernel.php or routes/console.php.bref local:invoke or a dedicated Lambda function for one-off commands. This is handy for migrations (php artisan migrate --force) during deployment or via manual invocation.php artisan serve for web and php artisan queue:work for queues. Use vendor/bin/bref local to invoke handlers with Lambda-shaped events. This catches handler wiring issues before deploy.php artisan config:cache && php artisan route:cache && php artisan view:cache. Do it after env vars are set at deploy time; don't cache a local .env.LOG_CHANNEL=stderr so Bref forwards logs to CloudWatch. Use LOG_STDERR_FORMATTER if you want JSON lines. Avoid the default single/stack file driver in Lambda.FILESYSTEM_DISK=s3 and use S3 for uploads; Lambda's /tmp is ephemeral and small.batchSize and maximumBatchingWindow in serverless.yml. With the native handler, enable partial batch failure reporting (FunctionResponseTypes: [ReportBatchItemFailures]) so only failed messages are retried.failed() hooks, and queue events (JobProcessing, JobFailed) after upgrading. Also confirm the handler class in serverless.yml still matches the README.ReportBatchItemFailures, a single failed message in a batch causes the entire batch to be retried. With the native handler, verify the response format and enable the feature in serverless.yml..env in Lambda: Bref does not load .env. Put secrets in SSM Parameter Store or Secrets Manager and reference them via serverless.yml or a small bootstrap. Never commit APP_KEY.node_modules, tests, docs). Run php artisan optimize in the build. Use provisioned concurrency only if latency is critical.DB_CONNECTION and pool sizes conservatively.serverless logs -f <function> -t tails CloudWatch. For local reproduction, bref local:invoke with a recorded event payload is more reliable than guessing the event shape.timeout on the Lambda function to match the work; set QUEUE_* and job $timeout consistently. A job timeout longer than the Lambda timeout will be killed mid-run.How can I help you explore Laravel packages today?