> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ghostable.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel Forge

> Deploy Ghostable as part of your Laravel Forge deployment script.

<Warning>
  Ghostable CLI 1.x is legacy. Prefer the current [Desktop
  docs](/desktop/v1/getting-started/overview) or [CLI 2.x
  docs](/cli/v2/getting-started/installation) for new work.
</Warning>

## Requirements

* [Ghostable CLI](https://github.com/ghostable-dev/cli) installed in your app.
* A `GHOSTABLE_CI_TOKEN` (environment-scoped). Store it in your Forge environment, or in your CI/CD
  secrets if you are deploying automatically.

## Deployments

Add Ghostable’s `deploy:forge` command to your Forge **deployment script**.\
Be sure the `GHOSTABLE_CI_TOKEN` you are using corresponds with the Ghostable environment you intend
to deploy.

```bash Example theme={null}
cd /home/forge/default

git pull origin $FORGE_SITE_BRANCH
$FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader

# Prevent concurrent php-fpm reloads...
touch /tmp/fpmlock 2>/dev/null || true
( flock -w 10 9 || exit 1
    echo 'Reloading PHP FPM...'; sudo -S service $FORGE_PHP_FPM reload ) 9</tmp/fpmlock

npm ci && npm run build

if [ -f artisan ]; then
    $FORGE_PHP artisan optimize
    $FORGE_PHP artisan migrate --force

    # Deploy Ghostable-managed environment variables
    $FORGE_PHP vendor/bin/ghostable deploy:forge

    $FORGE_PHP artisan config:cache
fi
```

<Note>
  Ghostable merges its managed variables with those already in Forge. Existing keys are updated in
  place, new keys are added, and anything unmanaged is left untouched.
</Note>

## Encryption

Environment file encryption works in Forge just like it does in Vapor. Pass the `--encrypted` flag
to `deploy:forge`, and Ghostable will bundle variables into an encrypted file. Ghostable
automatically generates and stores the required `LARAVEL_ENV_ENCRYPTION_KEY` in your Forge
environment so decryption works at runtime.

```bash Deployment Script theme={null}
$FORGE_PHP vendor/bin/ghostable deploy:forge --encrypted
```

Benefits:

* Eliminates the need to commit encrypted .env files into source control.
* Reduces merge conflicts when working in teams.

## FAQS

<AccordionGroup>
  <Accordion title="Do Forge rollbacks still work as expected?">
    Yes — Forge rollbacks behave as normal. But note: - Rollbacks affect the **code** and
    deployment artifact only. - Ghostable-managed variables are not rolled back automatically.
    <Note>If you need to roll back variables, perform the rollback in Ghostable as well.</Note>
  </Accordion>

  <Accordion title="Does Ghostable remove variables from Forge when I delete them?">
    No — Ghostable only pushes the variables it manages. If you remove a variable from
    Ghostable, it is not automatically removed from Forge.

    <Warning>
      Manually clean up unused variables in Forge to avoid confusion or security risk.
    </Warning>
  </Accordion>

  <Accordion title="What happens if I switch between plain and encrypted variables?">
    Ghostable tracks the delivery mode for each variable, but Forge may still have old copies.

    <Tip>
      When migrating a variable between plain and encrypted, remove the old copy from Forge
      once you’ve confirmed your app is reading the new value.
    </Tip>
  </Accordion>
</AccordionGroup>
