Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 24, 2026·3 min de lecture

Bref — Serverless PHP on AWS Lambda

Custom AWS Lambda runtimes and tools for deploying PHP applications as serverless functions and web applications.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Bref Serverless PHP
Commande d'installation directe
npx -y tokrepo@latest install cb0aabe3-86f9-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Bref provides custom AWS Lambda runtimes that let PHP applications run natively on Lambda. It packages PHP as a Lambda layer, handles request/response translation, and integrates with the Serverless Framework for deployment.

What Bref Does

  • Provides PHP runtime layers for AWS Lambda supporting PHP 8.x
  • Translates API Gateway and ALB events into PSR-7 or standard PHP requests
  • Supports two modes: HTTP applications (web apps) and event-driven functions
  • Integrates with Laravel, Symfony, and other PHP frameworks
  • Manages deployment through Serverless Framework or AWS CDK

Architecture Overview

Bref publishes pre-compiled PHP binaries as Lambda layers. When a Lambda function is invoked, the Bref runtime bootstraps PHP, receives the event from the Lambda Runtime API, and passes it to your handler. For HTTP workloads, the php-fpm layer runs PHP-FPM as a child process, translating API Gateway events into FastCGI requests. For event-driven workloads, the function layer calls a PHP callable directly. Deployment artifacts are built by the Serverless Framework, which packages your code and references the correct Bref layer ARN.

Self-Hosting & Configuration

  • Requires an AWS account with Lambda, API Gateway, and IAM permissions
  • serverless.yml defines functions, runtime layers, and event triggers
  • PHP extensions are included in the base layer; additional ones available as extra layers
  • Environment variables are set in serverless.yml and accessible via getenv()
  • Local development supported through serverless invoke local or Docker-based emulators

Key Features

  • Pre-built Lambda layers with PHP-FPM and CLI runtimes for PHP 8.x
  • Native support for Laravel (via Laravel Vapor alternative) and Symfony
  • Console command execution on Lambda for cron jobs and queue workers
  • Static asset handling through S3 with CloudFront integration
  • Cold start optimization through smaller deployment packages and layer caching

Comparison with Similar Tools

  • Laravel Vapor — Commercial, Laravel-only; Bref is open-source and framework-agnostic
  • Vercel PHP — Limited PHP support; Bref provides full PHP-FPM runtime on Lambda
  • AWS Lambda Web Adapter — Generic adapter; Bref is purpose-built for PHP with FPM integration
  • Serverless Docker (Fargate) — Container-based, always running; Bref is event-driven with per-request billing

FAQ

Q: Which PHP versions does Bref support? A: Bref maintains layers for actively supported PHP versions, currently PHP 8.1 through 8.3.

Q: Can I use Bref with Laravel? A: Yes. Bref has dedicated documentation and packages for running Laravel on Lambda, including queue and scheduler support.

Q: How do I handle static assets? A: Static files are typically served from S3 behind CloudFront. Bref provides tooling to separate assets from the Lambda deployment package.

Q: What about cold starts? A: PHP-FPM cold starts on Lambda typically range from a few hundred milliseconds to about one second. Provisioned concurrency can eliminate them for latency-sensitive workloads.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires