Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions docs/src/content/docs/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ Configuration lives in PHP files that return arrays:
declare(strict_types=1);

return [
'default' => env('DB_CONNECTION', 'pgsql'),
'connections' => [
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => (int) env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'marko'),
'username' => env('DB_USERNAME', 'marko'),
'password' => env('DB_PASSWORD', ''),
],
],
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => (int) env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'marko'),
'username' => env('DB_USERNAME', 'marko'),
'password' => env('DB_PASSWORD', ''),
];
```

Expand All @@ -48,7 +43,7 @@ class DatabaseService

public function getHost(): string
{
return $this->configRepository->getString('database.connections.pgsql.host');
return $this->configRepository->getString('database.host');
}
}
```
Expand Down
17 changes: 6 additions & 11 deletions docs/src/content/docs/guides/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,12 @@ Configure your connection in `config/database.php`:
declare(strict_types=1);

return [
'default' => env('DB_CONNECTION', 'pgsql'),
'connections' => [
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => (int) env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'marko'),
'username' => env('DB_USERNAME', 'marko'),
'password' => env('DB_PASSWORD', ''),
],
],
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'port' => (int) env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'marko'),
'username' => env('DB_USERNAME', 'marko'),
'password' => env('DB_PASSWORD', ''),
];
```

Expand Down
24 changes: 9 additions & 15 deletions docs/src/content/docs/packages/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,32 +126,26 @@ if ($config->has('feature.experimental')) {

Access nested configuration values using dot notation. The filename becomes the top-level key.

```php title="config/database.php"
```php title="config/mail.php"
<?php

declare(strict_types=1);

return [
'default' => 'mysql',
'connections' => [
'mysql' => [
'host' => 'localhost',
'port' => 3306,
],
'pgsql' => [
'host' => 'localhost',
'port' => 5432,
],
'driver' => 'smtp',
'from' => [
'address' => 'hello@example.com',
'name' => 'My App',
],
];
```

```php
<?php
// Access nested values (filename "database" is the top-level key)
$default = $config->get('database.default'); // 'mysql'
$host = $config->get('database.connections.mysql.host'); // 'localhost'
$port = $config->get('database.connections.pgsql.port'); // 5432
// Access nested values (filename "mail" is the top-level key)
$driver = $config->get('mail.driver'); // 'smtp'
$address = $config->get('mail.from.address'); // 'hello@example.com'
$name = $config->get('mail.from.name'); // 'My App'
```

### Environment Variables
Expand Down