Download the PHP package atldays/laravel-secrets without Composer

On this page you can find all versions of the php package atldays/laravel-secrets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-secrets

Laravel Secrets

Latest Version on Packagist Total Downloads CI

atldays/laravel-secrets lets Laravel applications load sensitive configuration from external secret providers without turning every request into a network call.

It gives you the same developer experience as regular environment variables, but the values come from a provider, are cached inside Laravel, and are applied during boot only from that cached payload.

That means:

This package is designed for teams that want a safer and more operationally friendly alternative to keeping production secrets directly in .env files.

Why Use It

Most Laravel applications still depend on environment variables for things like:

That works well in local development, but in production it often means:

Laravel Secrets keeps the familiar Laravel config flow, but moves secret storage to a provider and uses Laravel cache as the runtime handoff.

How It Works

The package uses a simple two-step flow:

  1. php artisan secrets:cache fetches secrets from every configured driver, or from one driver when you pass --driver.
  2. The resulting payload is stored in the configured Laravel cache store.
  3. During application boot, the package reads only that cached payload.
  4. The package writes the resolved values into Laravel's env repository and into the config paths defined in config_variables.

No provider calls are made while handling a normal HTTP request, queue job, or console command unless you explicitly ask for fresh values.

Supported Drivers

Currently supported drivers:

More drivers are welcome. See CONTRIBUTING.md for the driver contribution workflow.

Installation

Compatibility

Current support matrix:

The package is tested in CI across the supported Laravel versions, and the AWS driver also includes live integration coverage.

Publish the config when you want to customize the package:

Quick Start

Minimal setup:

Then refresh the cache:

From that point on, the application boots with cached secrets applied to the env repository and to the config paths you mapped in config_variables.

Configuration

apply_secrets

Controls whether cached secrets should be applied during boot.

failure_mode

Controls what happens when applying cached secrets during boot fails.

Supported values:

This affects boot-time application of cached secrets, not the secrets:cache command itself. The cache command always reports its own execution errors directly.

cache

Controls where the secrets payload is stored after a successful refresh.

The default ttl is 43200, which equals 30 days.

config_variables

This is the explicit bridge between your secret payload and Laravel config.

Laravel resolves many env() calls before package boot, so the package cannot rely on env mutation alone. That is why config_variables exists.

Example:

AWS Secret Manager

Driver Configuration

The AWS driver supports:

Example:

AWS Authentication Best Practices

If your application runs on AWS infrastructure, prefer IAM-based runtime credentials instead of hardcoding access keys.

Recommended:

This lets the AWS SDK resolve credentials automatically without storing long-lived secrets in your application environment.

If your application runs outside AWS, use standard AWS SDK credentials such as:

That works fine, but should usually be treated as the less preferred option compared to IAM-based runtime identity on AWS-managed infrastructure.

Pagination

The AWS driver supports provider pagination through NextToken.

If you set list_max_results, the package passes it to AWS as MaxResults and keeps requesting pages until the full result set is collected.

This is useful when you want explicit control over page size or when you want to verify pagination behavior in integration tests.

Secret Shapes

The AWS driver supports multiple secret shapes.

JSON object

If the secret value is a JSON object, every key becomes a secret entry.

Example:

Result:

name / value wrapper

If the secret value looks like this:

the package produces exactly one secret entry:

Plain text

If the secret is plain text, the final key is derived from the secret name using key_strategy.

Given:

With basename:

With name:

SecretBinary

SecretBinary is supported. When AWS returns binary data in base64 form, the driver decodes it before building the final payload.

Filtering

Filtering is built around a driver-agnostic contract, so the same model can be reused by future drivers.

Built-in AWS Filter

The package ships with Atldays\Secrets\Filters\AwsSecretManagerFilter.

Its filter_options support:

Example:

The built-in AWS filter treats tags, prefixes, and names as OR conditions inside the filter itself.

If all filter_options are empty, all available AWS secrets match.

Custom Filters

You can replace the built-in filter with your own class, or pass multiple filter classes.

Each filter must implement Atldays\Secrets\Contracts\SecretFilter.

Example:

Use it like this:

Or combine multiple filters:

Supported filter_mode values:

Meaning:

Secret References

Filters receive a SecretReferenceContract, not the final secret value.

That is intentional.

It allows filters to decide whether a secret should be fetched without exposing the secret payload itself during the listing stage.

The current reference object includes:

For AWS, metadata contains the raw ListSecrets entry, such as:

It does not contain:

Useful helper methods on the reference include:

Public API

Facade

The package exposes the Secrets facade as the main public entry point.

Commands

secrets:cache

Fetches fresh secrets from the provider and stores them in the configured cache.

Use it when:

Optional flags:

Example:

secrets:clear

Removes the cached payload from the configured cache store.

Use it when:

Example:

secrets:list

Reads secrets from the configured cache and lists the resolved secret names.

By default, values are masked.

Use it when:

Optional flags:

Examples:

secrets:get

Reads one named secret from the configured cache.

Use it when:

Optional flags:

Examples:

Deployment Example

A typical deployment flow looks like this:

This ensures the provider API is contacted during the deployment phase, not during normal request handling.

When APP_ENV=production, revealing values requires --force.

Security Notes

Testing Status

The package currently includes:


All versions of laravel-secrets with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
aws/aws-sdk-php Version ^3.337
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
spatie/laravel-data Version ^4.20
spatie/laravel-package-tools Version ^1.92
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package atldays/laravel-secrets contains the following files

Loading the files please wait ...