Tempest guide

M↓

Tempest is a PHP web and console application framework built around automatic code discovery — no config files needed for routing, commands, or event listeners. It requires PHP 8.5+ and does not enforce a specific project structure.

This is work in progress. We are still learning about Tempest.

Get ready

You should have a local PHP development environment running on your local machine. Tempest requires PHP 8.5+ and Composer.

Install Tempest locally

Follow the official Tempest installation guide to create a local Tempest project. This can be a new or existing project. To create a new project:

composer create-project tempest/app my-app
cd my-app
shell

Setup GitHub

Optional but recommended: To enable git deployment, init git and add GitHub as a remote repo, either as public or private. Here's how to use GitHub CLI to set up a local repo and connect it to GitHub:

# 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'
shell

You can also use SSH / SFTP or rsync to deploy, or integrate with your existing pipelines using deploy keys.

Create an app at fortrabbit

Create a new app in the fortrabbit dashboard. The wizard will guide you through the steps. You can connect the repo from GitHub.

The software detection wizard will likely catch that your code base is Tempest. So root path and env vars are likely already pre-configured.

Create signing key

Under certain conditions it might be required to set a signing key. This can be done like so:

# Login by SSH
$ ssh {{app-env-id}}@ssh.{{region}}.frbit.app

# Create the signing key
php tempest key:generate
shell

The signing key can also be part of the ENV vars with the key SIGNING_KEY.

Root path

If not already, set the root path to public in the dashboard.

ENV vars

Tempest reads configuration from environment variables. When using MySQL, make sure the following ENV vars are set in the dashboard (likely already pre-populated):

DATABASE_HOST=${FORTRABBIT_MYSQL_HOST}
DATABASE_DATABASE=${FORTRABBIT_MYSQL_DATABASE}
DATABASE_USERNAME=${FORTRABBIT_MYSQL_USER}
DATABASE_PASSWORD=${FORTRABBIT_MYSQL_PASSWORD}
DATABASE_PORT=3306
shell

Database configuration

Tempest uses SQLiteConfig by default. To switch to MySQL, create or update 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'),
);
php

Running migrations manually via SSH:

ssh {{app-env-id}}@ssh.{{region}}.frbit.app 'php tempest migrate:up'
shell

Deployment configuration

We suggest the following commands during git deployment:

# 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
shell

See the tempest docs have a deployment section for more commands to run during deployment (discovery, …).

Found a tpyo?Edit