Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Config Laravel Package

league/config

Define and validate nested PHP configuration with strict schemas (via Nette Schema). Merge multiple config sources, apply defaults, enforce types/constraints, and read values using convenient dot notation. Ideal for robust, structured app and library config.

View on GitHub
Deep Wiki
Context7

layout: homepage

{% assign version = site.data.project.default_version %}

Features

Expressive, Fluent API

use League\Config\Configuration;
use Nette\Schema\Expect;

$config = new Configuration([
    'database' => Expect::structure([
        'driver' => Expect::anyOf('mysql', 'postgresql', 'sqlite')->required(),
        'host' => Expect::string()->default('localhost'),
        'port' => Expect::int()->min(1)->max(65535),
        'database' => Expect::string()->required(),
        'username' => Expect::string()->required(),
        'password' => Expect::string()->nullable(),
    ]),
]);

Easily Access Nested Values

echo $config->get('database.driver');

// or using slashes, if you prefer that syntax:
echo $config->get('database/driver');

Set Options Individually Or Together

use League\Config\Configuration;

$config = new Configuration([/*...*/]);

$config->merge([
    'database' => [
        'driver' => 'mysql',
        'port' => 3306,
        'host' => 'localhost',
        'database' => 'myapp',
        'username' => 'myappdotcom',
        'password' => 'hunter2',
    ],
]);

if ($_ENV['APP_ENV'] === 'prod') {
    $config->set('payment_gateway.test_mode', false);
}

Combine Multiple Schemas Into One

use League\Config\Configuration;

$config = new Configuration();
$config->addSchema('database', DB::getConfigSchema());
$config->addSchema('logging', Logger::getConfigSchema());
$config->addSchema('mailer', Mailer::getConfigSchema());
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk