Download the PHP package imran/laravel-dynamic-config without Composer

On this page you can find all versions of the php package imran/laravel-dynamic-config. 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-dynamic-config

Laravel Dynamic Config 🚀

Latest Version on Packagist Total Downloads License

Take control of your Laravel application configuration at runtime. Load, merge, and override configuration from multiple sources like Databases, YAML, JSON, and PHP files without redeploying your app.


🌟 Why Laravel Dynamic Config?

In modern web applications, configuration often needs to be more than just static .env or PHP files. Whether it's white-labeling settings, feature flags stored in a database, or environment-specific overrides in YAML/JSON, managing these can become a nightmare.

The Problem

The Solution

Laravel Dynamic Config provides a robust, priority-based configuration engine that hooks directly into Laravel's core. It allows you to define multiple "sources" of truth and merges them intelligently, giving you a unified config() API while keeping your application fast with built-in caching.


✨ Features


🚀 Installation

You can install the package via composer:

Publish the configuration file:

If you plan to use the database driver, publish and run the migration for its default app_configs table (key/value columns):

Note: If you intend to use YAML configurations, ensure you have the symfony/yaml package installed: composer require symfony/yaml

Configuration

Define your sources in config/dynamic-config.php:

Artisan Commands

Caching Configurations

Because dynamic configurations bypass Laravel's native config:cache, you must use this package's cache commands for production performance.

To clear the generated cache:

Debugging Resolutions

Ever wonder where a config value came from? Use the debug command to see a resolution tree for a specific key:

Output:

Configuration Options

Key Default Purpose
merge_strategy deep deep, replace (array_replace_recursive), or append (array_merge_recursive).

With deep (the default), list-style arrays (app.providers, cors.allowed_origins, a middleware group, etc.) are replaced wholesale by whichever source sets them last, not merged index-by-index - so overriding a 3-item list with a 1-item list actually results in a 1-item list, and overriding with [] actually clears it. Associative arrays (database.connections.mysql.*, app.*, ...) still merge key-by-key as expected.

| fail_silently | true | Log and skip a source that fails to load instead of crashing the request/command. Set false in local/CI to catch broken sources immediately. | | auto_refresh | false | Detect when a file-based source changed since the last dynamic-config:cache run and rebuild live instead of serving stale cache. Adds a few filemtime() checks per request - fine for local/staging, leave off in production. | | protected_keys | [] | Dot-notation paths (wildcards supported) that no dynamic source may ever set. See Security below. | | protect_sensitive_keys | true | Automatically block any path whose last segment looks like a secret, even if it's not in protected_keys. See Security below. | | sensitive_key_exceptions | [] | Exact dot paths allowed to bypass protect_sensitive_keys for a deliberate use case (e.g. rotating one specific secret via the database driver). | | sources[].environments | — | Restrict a source to specific environments, e.g. 'environments' => ['production']. |

Security: the database (and api) driver trust boundary

Any row in your app_configs table (or any value returned by an api source) can set any config path - the merge doesn't know or care where a key came from. That's fine as long as only trusted code/administrators can write to that table or endpoint. If it's ever reachable through a less-trusted path (a tenant self-service settings screen, an admin panel with a mass-assignment bug, a compromised upstream API), that becomes a path to full config takeover. Three layers guard against this:

1. app.key and app.cipher are always protected, unconditionally, with no config option and no exception list that can override it. There's no legitimate reason for a runtime source to change Laravel's encryption key, and doing so would silently break decryption of every cookie/session/Crypt::encrypt() value already out there.

2. protect_sensitive_keys (on by default) blocks any path whose last segment looks like a secret - password, secret, token, credential, api_key, secret_key, private_key, access_key, client_secret, auth_token - anywhere in the tree, without you having to list every one by hand. This applies to every driver, not just database/api - a services.stripe.secret key checked into your own json/yaml/php dynamic-config file is blocked by default too, since the merge has no reliable way to know a file source is "trusted" while a database source isn't. If you deliberately want to set a secret through a dynamic source (file or DB), allow just that path:

3. protected_keys covers anything else you want locked down that isn't secret-named - database.connections, session, feature flags that should never move, etc:

Entries in both lists support Str::is()-style wildcards (e.g. 'mail.*') and also block anything nested under them ('database.connections' blocks database.connections.mysql.host too). Protection is enforced by snapshotting the real value at each protected path before any source is merged in, and forcing it back afterward - so a source can't get around it by overwriting a shallower ancestor (e.g. setting the whole app key to a single scalar) instead of the exact protected leaf.

dynamic-config:debug also redacts any value whose key looks sensitive (*password*, *secret*, *token*, *key*, *credential*) by default, recursively through nested arrays - pass --reveal to print it anyway.

Extending Drivers

You can easily add your own drivers (e.g., API, Redis, Vault) by creating a class that implements Imran\DynamicConfig\Contracts\ConfigDriver and extending the ConfigManager inside your AppServiceProvider.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-dynamic-config with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/config Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
symfony/yaml Version ^6.0|^7.0
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 imran/laravel-dynamic-config contains the following files

Loading the files please wait ...