Install the SecretStash PHP / Laravel CLI

Install the SecretStash CLI package for secure variable management in Laravel or any PHP application.

The SecretStash CLI works with any PHP project. Choose the installation path that matches your framework:

  • Laravel: Install as an Artisan package with full service-provider integration.
  • Standalone (any PHP project): Install via Composer and use the vendor/bin/secret-stash binary.

Requirements

  • PHP 8.2+
  • Composer
  • A SecretStash API token and Application ID

Laravel Installation

Install the CLI package

Install the Composer package in your Laravel app:

composer require dniccum/secret-stash-cli

Authenticate

The installer registers this device with SecretStash, so it needs an API token first. Log in to generate one and store it in your app's .env:

php artisan secret-stash:login

Or create an API token in SecretStash (Profile → Tokens) and add it yourself:

SECRET_STASH_API_TOKEN=your_token_here

Run the installer

It will optionally publish a config file, then generate this device's key pair and register its public key with SecretStash.

php artisan secret-stash:install

Set your application ID

Add the application ID to your app's .env:

SECRET_STASH_APPLICATION_ID=your_application_id_here
  • Create or select an Application in SecretStash and copy its ID.

Optional: Publish config

If you want to customize behavior, publish the config file:

php artisan vendor:publish --tag=secret-stash-config

This creates config/secret-stash.php where you can set ignored variables, override the API URL, and more. See Configuration for details.

Standalone Installation (Non-Laravel)

Install the CLI package

Install the Composer package in your PHP project:

composer require dniccum/secret-stash-cli

Authenticate

The installer registers this device with SecretStash, so it needs an API token first. Log in to generate one and store it in your project's .env file:

vendor/bin/secret-stash secret-stash:login

Or create an API token in SecretStash (Profile → Tokens) and add it yourself:

SECRET_STASH_API_TOKEN=your_token_here

Run the installer

Run the installer using the standalone binary. It generates this device's key pair and registers its public key with SecretStash.

vendor/bin/secret-stash secret-stash:install

Set your application ID

Add the application ID to your project's .env file:

SECRET_STASH_APPLICATION_ID=your_application_id_here
  • Create or select an Application in SecretStash and copy its ID.

Next steps