Ghostable + Lerd: Run Commands Without Exporting .env | Ghostable                            Article

 [ Blog ](https://ghostable.dev/blog)

 [ Articles ](https://ghostable.dev/blog/articles)

 [ Best Practices ](https://ghostable.dev/blog/category/best-practices)

   Friday, September 25, 2026

 Ghostable + Lerd: Run Commands Without Exporting .env
=======================================================

  Run PHP and Artisan commands through Lerd with Ghostable environment values, without exporting a plaintext .env file.

   ![Ghostable + Lerd: Run Commands Without Exporting .env](https://fls-9fca3102-944c-48ac-a3cc-22f1b47a39c7.laravel.cloud/blog/01a0da35-4a20-72be-96b7-713445337273/ghostable-lerd-env-injection.png) Ghostable now works with Lerd to run PHP and Artisan commands using your Ghostable environment values, without exporting a plaintext `.env` file first.

If you use Lerd for local development, you can keep your configuration in Ghostable and pass it directly to the command that needs it.

Run your commands with Ghostable
--------------------------------

From a project already set up with Ghostable and Lerd, wrap your command with `ghostable env run`:

```bash
ghostable env run --env local -- lerd php artisan migrate:status

```

Ghostable decrypts the `local` environment on your machine, and Lerd passes those values into the PHP command inside its container. Use your own environment name and make sure its database settings are reachable from Lerd.

The same pattern works for other PHP and Artisan commands. When a command needs only a few variables, add `--only` to select the Ghostable keys it receives.

Support is available in [Ghostable CLI 3.1.1](https://github.com/ghostable-dev/ghostable/releases/tag/v3.1.1) with Lerd 1.35.0. Ghostable handles Lerd's environment passthrough automatically.

Configuration for the command you run
-------------------------------------

The values are passed to the command you launch. This does not configure PHP-FPM web requests or Lerd's background workers, and it does not change processes that are already running.

Your values stay encrypted in `.ghostable/` until Ghostable decrypts them locally for use. No hosted Ghostable service receives your plaintext secrets. The command receives plaintext at runtime, so application code can still log or write it to disk. Laravel's `config:cache`, for example, writes resolved configuration to a file.

To get started, follow the [Ghostable new-project guide](https://ghostable.dev/docs/3.x/getting-started/new-projects), then use the wrapper above with your Lerd commands.

 [   Back to blog ](https://ghostable.dev/blog) [All articles](https://ghostable.dev/blog/articles)

  Want product news and updates?
--------------------------------

 Sign up for our newsletter.

   Email Address

  Subscribe →    Subscribing...

We care about your data. Read our [privacy policy](https://ghostable.dev/privacy).
