Integration guides

Laravel Forge deployment hook

Set up DeployState with Laravel Forge

Add two small curl calls around the deploy command you already use. Forge runs them on the server, DeployState turns them into one clear desktop signal.

01 / Configure the platform

Put the hook beside the deployment work.

Find Server → Sites → your site → Deployment Script. The exact commands stay in the tool you already trust; DeployState only receives the lifecycle signal before and after it runs.

  1. 01

    Create a sequence step

    Give the step a name such as “Production app” and copy its private hook base URL from DeployState.

  2. 02

    Store the base URL as a secret

    Add DEPLOYSTATE_HOOK_URL to the site environment. Its value ends at the step token—do not include /start or /complete yet.

  3. 03

    Wrap the Forge deployment script

    Paste the start and complete calls around your existing script, then save. Your next deploy opens the live run automatically.

02 / Shell example

A single private base URL, three possible states.

Put the start hook before the deploy work begins. Put the complete hook after a successful deploy. Use the failure example only if you manage errors in the script yourself.

ShellDEPLOYSTATE_HOOK_URL
curl --fail --silent --show-error -X POST "$DEPLOYSTATE_HOOK_URL/start"

php artisan down --render="errors::503"
git pull origin main
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan migrate --force
php artisan optimize
php artisan up

curl --fail --silent --show-error -X POST "$DEPLOYSTATE_HOOK_URL/complete"

Set DEPLOYSTATE_HOOK_URL to the private URL copied from a step, for example https://your-deploystate-url/api/v1/hooks/{step-token}. Append /start, /complete, or /fail exactly as shown.

If you choose a readable endpoint, store its URL and token separately: DEPLOYSTATE_HOOK_URL=https://your-deploystate-url/api/v1/production/deploy and DEPLOYSTATE_HOOK_KEY={step-token}, then add -H "X-DeployState-Key: $DEPLOYSTATE_HOOK_KEY" to each curl call.

03 / Protect the signal

Keep the credential in the platform’s secret store.

  • Do not paste a private hook into source control, an issue, or build output.
  • For a readable endpoint, keep DEPLOYSTATE_HOOK_KEY private even though the URL itself is safe to read.
  • Give each deploy concern its own step so one integration never needs another integration’s credential.
  • Rotate the hook from the DeployState step editor if it is exposed or no longer needed.

Ready to test

The next deployment will show up on its own.

Start free