Setup
You can deploy PHP applications with Bref using either:
- Bref Cloud (simplest, most features, free and paid plans available)
- or the Serverless CLI (opens in a new tab) (more complex, fewer features built-in, free)
Bref Cloud is the easiest way to deploy PHP applications. It simplifies setting up and managing AWS credentials, and it provides a dashboard to manage your applications, view logs, and more. Learn more about Bref Cloud.
This page will help you set up your environment for either option.
Before getting started, you will need PHP (8.0 or greater) and NPM (opens in a new tab) installed.
Bref Cloud
To use Bref Cloud, you will need a Bref Cloud account, an AWS account, and the bref
CLI. Let's get started:
Bref Cloud account
First, visit bref.cloud (opens in a new tab) to create an account.
You can select a free plan, or start a free trial of the paid plans (compare plans (opens in a new tab)).
AWS account
Bref Cloud deploys your applications to your AWS account.
To create an AWS account, go to aws.amazon.com (opens in a new tab) and click Sign up. Bref Cloud will guide you through the process of creating an AWS account and connecting it to Bref Cloud.
If you want to learn more about how Bref Cloud connects securely to your AWS account, read the "Security" documentation.
AWS has a generous free tier that will usually allow you to deploy your first serverless applications for free.
Bref CLI
Next, let's install the Bref CLI:
composer global require bref/cli
Finally, let's connect the CLI to your Bref Cloud account:
bref login
If the bref
command is not found, or if you want more details on how to install the CLI, read the detailed installation instructions.
That's it, you're ready to use Bref with Bref Cloud!
Serverless CLI
If you don't want to use Bref Cloud, you can deploy PHP applications using the open-source Serverless CLI (opens in a new tab).
To use Bref with the Serverless CLI, you will need an AWS account, the serverless
CLI, and AWS credentials. Let's get started:
AWS account
Bref deploys your applications to your AWS account. To create one, go to aws.amazon.com (opens in a new tab) and click Sign up.
AWS has a generous free tier that will usually allow you to deploy your first serverless applications for free.
Serverless CLI
Bref relies on the Serverless Framework (opens in a new tab) and AWS access keys to deploy applications. You will need to install the serverless
CLI using NPM:
npm install -g osls
The original Serverless Framework (opens in a new tab) is no longer open-source. An open-source alternative is OSS Serverless (opens in a new tab), created and maintained by Bref maintainers. This is a drop-in replacement for the original CLI and is used throughout this documentation.
AWS credentials
Finally, we need AWS credentials so that the serverless
CLI can deploy to AWS.
If you have already set up AWS credentials on your machine (for example if you use the aws
CLI), you can skip this step.
-
Set up those keys by running:
serverless config credentials --provider aws --key "key" --secret "secret"
This will store the credentials in
~/.aws/credentials
(the official file for AWS credentials (opens in a new tab)). This is the same as running theaws configure
command with theaws
CLI.Alternatively (for example in CI/CD), you can store credentials in environment variables:
export AWS_ACCESS_KEY_ID=key export AWS_SECRET_ACCESS_KEY=secret
That's it, you're ready to use Bref with the Serverless CLI!