Simple and scalable PHP with serverless

Simplify your infrastructure and scale with ease.

Bref is an open-source project that helps you go serverless on AWS with PHP.

Symfony

serverless.yml

service: demo
 
provider:
    name: aws
 
functions:
    web:
        runtime: php-82-fpm
        handler: public/index.php
        events:
            - httpApi: '*'

38,352,085,100

requests, jobs, and messages handled with Bref in the last 30 days

    Why Bref? Why serverless?

    We're in 2024. Applications should scale automatically. Hosting should be reliable and cost-efficient. Infrastructure should accelerate development, not consume our time.

    Bref deploys PHP applications to AWS Lambda and sets up the rest of the infrastructure using serverless services.

    Simple.
    Instead of setting up and maintaining servers, define your application in a simple serverless.yml file. Then deploy to AWS with serverless deploy. Bref integrates with the Serverless Framework for a great developer experience.
    Scalable.
    Bref provides open-source runtimes to run PHP on AWS Lambda. AWS Lambda runs your code redundantly across data centers and scales in real-time. All automatically. Handle 1 request/second or 1000 with the same code.
    Cost-efficient.
    Instead of paying for servers that are idle most of the time, pay for the time the code is actually running. The AWS free tier even provides about 1 million free requests per month. Play with the serverless costs calculator.

    $ serverless deploy

     

    Deploying demo to stage dev (us-east-1)

     

    Service deployed to stack demo-dev (31s)

     

    endpoint: https://yti4le2q5.lambda-url.us-east-1.on.aws/

    functions:

    web: demo-dev-web (750 KB)

    cron: demo-dev-cron (750 KB)

    worker: demo-dev-worker (750 KB)

    Use cases

    Serverless means whatever you choose it to mean.

    Run PHP as usual, like on any server. Except it scales (almost) infinitely and you don't maintain the infrastructure.
    Lift-and-shift existing apps or build new ones with your favorite framework.

    Websites
    Run PHP websites with Laravel, Symfony or any other framework, with a worldwide CDN and your custom domain.
    HTTP APIs
    REST or GraphQL APIs deployed in seconds. Need more performance? Enable Laravel Octane or the Symfony equivalent.
    CLI commands
    Run DB migrations, admin commands, or any other CLI command from your machine or your CI/CD.
    Cron tasks
    Every day, every hour, every minute… Run CLI scripts, Symfony Console commands, or the Laravel Scheduler.

    Or go the extreme opposite: build event-driven microservices with infinitely scalable cloud services like SQS and EventBridge.

    Or anything in between, that works too.

    Job queues
    Run 1000 jobs with 1 worker in 1000 seconds, or with 1000 workers in 1 second. It's just as simple and it costs the same. SQS invokes your code directly, no long-running process to maintain.
    Event-driven microservices
    Decouple and scale microservices without container madness. Send messages to EventBridge and let it invoke your PHP classes directly. No integration to write.
    File processing
    S3 can invoke a PHP class whenever a new file is uploaded. Resize images, convert videos, generate PDFs…
    WebSockets
    AWS API Gateway manages the WebSocket connections for you. Send messages to your users in real-time.

    They sponsor the open-source project ❤️

    Premium sponsors

    Gold sponsors

    DepotSecuMailerEcomailSpreaker

    Become a sponsor and help Bref be a sustainable open-source project.

    Happy users and community

    “Bref is excellent. We've been running a Laravel app with it since 2020 and it's currently handling over 160 million requests per month without a hiccup.”

    Neil Morgan
    Neil Morgan
    @neil-r-morgan

    “Bref has been a boon for running our customer's applications. We've had a Laravel API on Bref for the last 12 months serve over 25 million requests with an average response time of 50ms.”

    Paul Giberson
    Paul Giberson
    @HalasLabs

    “Just finished migrating our production from Heroku to AWS Lambda via Bref. It'll save us around $2k a year 🤯”

    Zach Malter
    Zach Malter
    @zmalter99

    “Every time I throw something up onto AWS Lambda in PHP using Bref I marvel at how mega-useful it is. If you haven’t checked out Bref you’re probably missing out”

    Gary Hockin
    Gary Hockin
    @GeeH

    “When your production website with Symfony, API Platform and Bref handles more than 500 simultaneous connections without flinching…”

    $!m0n

    “I’ve been running APIs and websites with Bref in prod for over a year now. It is indeed as simple as you describe it.”

    Tobias Nyholm
    Tobias Nyholm
    @TobiasNyholm

    “There is something amazing and magical about Bref and serverless deploying stuff to the cloud.”

    Rob Waller
    Rob Waller
    @RobDWaller

    “Happily using Bref since 2019 to process millions of requests, jobs and scheduled tasks. It powers the best technical accomplishment of my career and has made me a better software engineer and open-source contributor.”

    Marco Deleu
    Marco Deleu
    @deleugyn

    “The team embraced Bref with lightning speed! We were able to roll out the first parts of our new event-driven architecture within days, crafting new features in a mere fraction of the time it used to take — truly mind-blowing!”

    Lorenzo Rogai
    Lorenzo Rogai
    @lorenzo-rogai

    “An incredible project and one we're very proud to use in production for a recent eCommerce project we launched that saw 32 million Lambda invocations last month.”

    Aran Reeks
    Aran Reeks
    @AranReeks

    “Bref defines how PHP should run on AWS Lambda. At Voxie, we sponsor Bref because it's more than a runtime — it's the best foundation for building scalable, efficient products on AWS Lambda.”

    John Laswell
    John Laswell
    @john_laswell

    Used by thousands of companies

    Get started with Bref on your own, or get in touch for support and consulting.

    Treezor20minutes.frMyBuilderGulli.frPhpStanbCast.fmEnoptea
    externals.io