Skip to content

Commit b5d7f61

Browse files
committed
feat(config): improve config handling
1 parent 7de5cf5 commit b5d7f61

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

app/config/bootstrap.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* required services, plugins, connections, etc. are loaded and ready to go
66
* for every request made to the application.
77
*/
8+
9+
use app\utils\Config;
10+
811
require_once __DIR__ . '/../../vendor/autoload.php';
912

1013
if (!file_exists(__DIR__ . '/config.php')) {
@@ -16,8 +19,7 @@
1619
* P.S. When you require a php file and that file returns an array, the array
1720
* will be returned by the require statement where you can assign it to a var.
1821
*/
19-
$config = require __DIR__ . '/config.php';
20-
Flight::set('config', $config);
22+
Flight::set('config', new Config(require __DIR__ . '/config.php'));
2123

2224
// Whip out the ol' router and we'll pass that to the routes file
2325
$router = Flight::router();

app/utils/Config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace app\utils;
6+
7+
use ArrayObject;
8+
9+
final class Config extends ArrayObject {
10+
}

0 commit comments

Comments
 (0)