umar-jimoh/laravel-secretsync

Sync secrets from secret managers into your Laravel app with ease.

v1.1.0 2025-06-02 17:30 UTC

This package is auto-updated.

Last update: 2025-06-28 16:27:12 UTC


README

SecretSync Logo

Total Downloads Latest Version Contribution License

Introduction

This package allows you to easily sync secrets from secret managers into your Laravel app. Currently, only Infisical is supported.

Once installed you can do stuff like this:

php artisan secretsync

๐Ÿ“ฆ Installation

You can install the package via composer:

composer require umar-jimoh/laravel-secretsync

Publish Config:

php artisan vendor:publish --provider="UmarJimoh\SecretSync\SecretSyncServiceProvider" --tag=config

๐Ÿงช Usage

Before syncing secrets, ensure you've properly set up your secret manager (e.g., Infisical) and provided the necessary credentials or identifiers in your .env file.

SECRETSYNC_PROVIDER="infisical"
INFISICAL_API_ENDPOINT=
INFISICAL_TOKEN=
INFISICAL_ENV=
INFISICAL_WORK_ID="your-infisical-project-id"

NOTE: Make sure to include and fetch APP_KEY from your secret manager. It must not be defined in the .env file to avoid conflicts and to ensure proper Laravel encryption.

Once the package is installed, you can sync secrets by running:

php artisan secretsync

This command fetches and applies secrets from your configured provider into your Laravel application.

You can enable caching so that secrets are stored and retrieved locally instead of fetching them from the provider every time. To enable this, configure the following in your .env file:

SECRETSYNC_CACHE=true
SECRETSYNC_CACHE_TTL=300   # (in seconds)
SECRETSYNC_CACHE_DRIVER=   # (optional, defaults to Laravel's default cache driver)

Secrets are securely encrypted using Laravel's cache driver.

You may also define these values in config/secretsync.php.

If you encounter issues during sync, use the --debug flag for more detailed error messages:

php artisan secretsync --debug

Alternatively, enable debugging via .env:

SECRETSYNC_DEBUG=true

NOTE: In production if you run php artisan optimize make sure you run php artisan secretsync afterward to ensure secrets are properly synced.

๐Ÿค Contributing

Please see CONTRIBUTING for details

๐Ÿ“ง Contact

If you have any questions, feel free to reach out to me at umarjimoh@hotmail.com or via Twitter.

๐Ÿ”— License

This package is open-source software licensed under the . MIT License.