illuminate/config
Illuminate Config is Laravel’s configuration repository. It loads and merges config files, lets you read and set values at runtime, supports environment-based defaults, and provides a consistent API for accessing app settings across services and packages.
Config component—used internally by Laravel but usable in non-Laravel PHP apps.Illuminate\Config\Repository with an array of config values and optionally a loader (e.g., FileLoader for .php files), then retrieve values via get('key').use Illuminate\Config\Repository;
use Illuminate\Filesystem\Filesystem;
$files = new Filesystem();
$loader = new Illuminate\Config\FileLoader($files, base_path('config'));
$config = new Repository($loader, ['app' => ['name' => 'MyApp']]);
$name = $config->get('app.name');
Repository in a static facade or singleton for convenience (similar to Laravel’s Config facade).env() calls inside config files to support .env values (requires manually calling $_SERVER/$_ENV—this package does not auto-load .env; that’s handled in Laravel’s bootstrap).FileLoader: Ideal for apps that want config cached or hot-reloaded during development; config files are resolved only when accessed.Repository::offsetGet() or get() with dot notation ('database.connections.mysql.host') to traverse nested arrays; supports fallback defaults via get('key', 'default_value').Repository (or interface Illuminate\Contracts\Config\Repository) and mock get() calls with withConsecutive() to assert expected config paths..env parsing: This package does not interpret env('KEY') calls in config files. To use env values, you must wrap calls like $_ENV['KEY'] ?? 'default' manually in your config files. Laravel does this via its DetectEnvironment bootstrapper.Config::set() with config:cache, this component has no built-in cache layer—implement caching via a custom CachedLoader or wrap Repository with your own caching middleware.illuminate/collections and contracts. Ensure compatible versions (e.g., v13.x requires PHP 8.3+ per composer.json).config/ automatically—must explicitly configure FileLoader with the correct path(s).LoaderInterface (e.g., ArrayLoader, JsonLoader) to load configs from JSON, databases, or YAML (with extra packages).Repository::inspect('some.key') to see how a value is resolved (though this is an internal method—use with caution across versions).ArrayLoader over FileLoader to avoid filesystem side effects:
$loader = new ArrayLoader(['app.timezone' => 'UTC']);
$config = new Repository($loader);
How can I help you explore Laravel packages today?