Bloom Docs
Laravel projects
Make isolated Laravel workspaces useful from the moment they open, with project scripts that prepare Valet, dependencies and data safely.
Prepare a Laravel project
A useful Laravel workspace needs more than a copied checkout. Give every workspace its own URL and database, then install dependencies and migrate it. The setup script below follows the pattern used by There There with Laravel Valet and PostgreSQL.
set -eu
cp "$BLOOM_ROOT_PATH/.env" .env
SITE="my-app-$(printf '%s' "$BLOOM_WORKSPACE_ID" | tr -cd '[:alnum:]' | cut -c1-10)"
valet link "$SITE"
valet secure "$SITE"
sed -i '' "s|^APP_URL=.*|APP_URL=https://$SITE.test|" .env
DATABASE="my_app_$(printf '%s' "$BLOOM_WORKSPACE_ID" | tr -cd '[:alnum:]' | cut -c1-12)"
if ! psql -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname = '$DATABASE'" | grep -q 1; then
createdb "$DATABASE"
fi
sed -i '' "s|^DB_DATABASE=.*|DB_DATABASE=$DATABASE|" .env
composer install
bun install
bun run build
php artisan migrate --seed --force
Treat that as a pattern, not a paste-ready script. PostgreSQL connection flags, queues, Passport keys and external services differ per project. Add a matching archive script that only unlinks the Valet site and drops databases with your workspace prefix. Never let cleanup operate on the database from the main checkout.
Setup and run scripts
Scripts run with both BLOOM_* and CONDUCTOR_*
environment variables set, with the same meanings, so a script written for
Conductor runs unchanged.
| Variable | What it holds |
|---|---|
*_WORKSPACE_PATH | The worktree directory. |
*_ROOT_PATH | The main checkout. |
*_WORKSPACE_NAME | The branch name, with slashes replaced by dashes. |
*_WORKSPACE_ID | The workspace's own id. |
*_DEFAULT_BRANCH | The project's default branch. |
*_PORT | The first of the ten ports allocated to this workspace. |
*_IS_LOCAL | Always 1. There is no cloud mode. |