Tempest guide
Tempest is a PHP framework that discovers routes, commands and event listeners in the code, without config files. On fortrabbit it needs PHP 8.5 and deploys with Composer and Git.
Get ready
A local development environment with PHP 8.5 and Composer. Set the PHP version of the environment to 8.5 too.
Install Tempest locally
See the Tempest installation guide. A new project:
composer create-project tempest/app my-app
cd my-app
Set up GitHub
For Git deployment, push the project to a GitHub repository, for example with the GitHub CLI:
# Setup local git repo
$ git init
$ git add -A
$ git commit -m 'Init'
# GitHub CLI to create/connect remote Git repo
$ gh repo new
# Follow the steps
# Push an existing local repository to github.com
# Add as remote and assign current branch as 'origin'
rsync over SSH works as well.
Create an app at fortrabbit
Create an app with Tempest as the software and connect the GitHub repository.
The software template sets the root path public and the database ENV vars.
Create signing key
Tempest signs some data with a key. Create it over SSH, or set the SIGNING_KEY ENV var:
# Login by SSH
$ ssh {{app-env-id}}@ssh.{{region}}.frbit.app
# Create the signing key
php tempest key:generate
ENV vars
Tempest reads its configuration from ENV vars. With MySQL, set these in the ENV vars:
DATABASE_HOST=${FORTRABBIT_DB_HOST}
DATABASE_DATABASE=${FORTRABBIT_DB_NAME}
DATABASE_USERNAME=${FORTRABBIT_DB_USER}
DATABASE_PASSWORD=${FORTRABBIT_DB_PASSWORD}
DATABASE_PORT=${FORTRABBIT_DB_PORT}
Database configuration
Tempest uses SQLite by default. For MySQL, create app/Config/database.config.php:
use Tempest\Database\Config\MysqlConfig;
return new MysqlConfig(
host: env('DATABASE_HOST', '127.0.0.1'),
port: (int) env('DATABASE_PORT', 3306),
username: env('DATABASE_USERNAME'),
password: env('DATABASE_PASSWORD'),
database: env('DATABASE_DATABASE'),
);
Run migrations by hand over SSH:
ssh {{app-env-id}}@ssh.{{region}}.frbit.app 'php tempest migrate:up'
Deployment configuration
Set these in the deployment settings:
# Build commands
## Install by composer
composer install --no-dev --prefer-dist --no-interaction --no-ansi --no-progress
# Post deploy commands
## Run database migrations (with MySQL enabled)
php tempest migrate:up
With a package.json, add npm install and npm run build to the build commands. See the Tempest deployment docs for more commands, such as discovery caching.