Installation
Install the SecretStash CLI package and configure environment variables for secure variable management in Laravel applications.
Requirements
- PHP 8.4+
- Laravel 11+
- A SecretStash API token and Application ID
Install the CLI package
Install the Composer package in your Laravel app:
Run the installer. It will optionally publish a config file and generate an encryption key stored locally for securing your variables.
This package creates a ~/.secret-stash directory on your machine. Ensure this folder is secure as it contains the keys required to decrypt your environment variables.
Configure environment variables
Add the following to your app's .env:
- Create an API token in SecretStash (Profile → Tokens).
- Create or select an Application in SecretStash and copy its ID.
The SecretStash CLI requires both the API key and Application ID to be present to work. Failure to set them will throw an error.
Optional: Publish config
If you want to customize behavior, publish the config file:
Next steps
- Use the CLI to pull/push variables between SecretStash and your
.env. - Explore all commands in the CLI reference.
- Learn more about the available configuration.
CLI source code: https://github.com/dniccum/secret-stash-cli