Laravel Packagev13.xMIT License0+ downloads

Dynamic Config: Config that changes without a deploy

Dynamic Config stores Laravel configuration values in your database, for the whole application or per company, branch or tenant. Load the scopes you need with Config::dynamic()->load(), and every config() call in your application sees the result.

$composer require pharaonic/laravel-dynamic-config
Key Features

Everything you need to configure at runtime

One macro on the Config facade, and Laravel's own config() for everything else.

Native Config API

Config::dynamic() extends Laravel's Config facade, and you read final values with config().

Global and Named Scopes

Store values for the whole application, per identifier or per Eloquent model, such as a company, a branch or a tenant.

Explicit Layering

Each load() applies one scope, and the scope you load last wins.

Safe Merging

mail.from.address overrides one value and keeps mail.from.name; associative arrays merge, lists are replaced.

Cached Scopes

One cache entry per scope, forgotten automatically by set() and forget().

Typed and Safe

Values keep their types as JSON, and unsupported values fail with errors that never include the value.

A quick look

Persist values per scope, load them in order, and read the result with config().

app/Http/Middleware/LoadBranchConfig.php
1use Illuminate\Support\Facades\Config;
2 
3// Persist: once, from a settings page or a seeder.
4Config::dynamic()->set('mail.from.address', '[email protected]');
5Config::dynamic('branch-12')->set('mail.from.address', '[email protected]');
6 
7// Apply: on every request, in the order you want them to win.
8Config::dynamic()->load();
9Config::dynamic('branch-12')->load();
10 
11// Read: with Laravel itself.
12config('mail.from.address'); // "[email protected]"
FAQ

Dynamic Config Questions

Quick answers about installing and using Dynamic Config.

What is Dynamic Config?

Store Laravel configuration values in the database, globally or per company, branch or tenant, and merge them into config() with one explicit load call. It's a free, open-source Laravel package by Pharaonic.

How do I install Dynamic Config?

Run composer require pharaonic/laravel-dynamic-config in your project's root directory, then php artisan migrate.

What does Dynamic Config require?

The latest release requires PHP 8.3+ and Laravel 13.

Does loading a branch also load the global values?

No. Each load() applies exactly one scope. Call Config::dynamic()->load() and then Config::dynamic('branch-12')->load() to layer the branch on top of the global values.

Does it query the database on every config() call?

No. load() merges the values into Laravel's config repository once, and each scope is cached until it is written. config() then reads memory as usual.

Does it work with config:cache, Octane and queue workers?

Yes. Dynamic values are applied on top of the cached config at runtime and never written into the cache file. Octane gives each request its own config, and the documentation shows how to restore the config between queue jobs.

Is Dynamic Config free to use?

Yes. Dynamic Config is open source under the MIT license, so you can use it in personal and commercial projects.

Where can I find the Dynamic Config documentation?

Read the Dynamic Config documentation for setup, configuration, and usage examples.

How do I report a bug or contribute to Dynamic Config?

Open an issue or a pull request on GitHub, or ask in the Pharaonic Discord.

Related Guides

Practical guides that use Laravel Dynamic Config, or solve the problem it was built for.

Ready to dig in?

Read the full documentation for installation, configuration, scopes and layering, merge rules, stored values, caching, long-running processes and real-world examples.