umar-jimoh / laravel-secretsync
Sync secrets from secret managers into your Laravel app with ease.
Requires
- php: ^8.2
Requires (Dev)
- laravel/pint: ^1.22
- orchestra/testbench: ^10.2
- pestphp/pest: ^3.8
This package is auto-updated.
Last update: 2025-06-28 16:27:12 UTC
README
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 runphp 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.