Field Manual PHP / Laravel reference
← Laravel

Configuration

Configuration centralizes application settings.

What it is

Configuration centralizes application settings.

When to use it

Read config at runtime; environment values belong in config files.

Syntax

config("services.payments.url");

Example

// config/payments.php
return ["timeout" => (int) env("PAYMENT_TIMEOUT", 5)];
// Application code:
$timeout = config("payments.timeout");

Common mistakes

Calling env() outside config can break after config:cache; clear cache after changing local config.

Related topics

Browse Laravel