|
5 | 5 | * required services, plugins, connections, etc. are loaded and ready to go |
6 | 6 | * for every request made to the application. |
7 | 7 | */ |
| 8 | +require_once __DIR__ . '/../../vendor/autoload.php'; |
8 | 9 |
|
9 | | -$ds = DIRECTORY_SEPARATOR; |
10 | | -require_once __DIR__ . $ds . '..' . $ds . '..' . $ds . 'vendor' . $ds . 'autoload.php'; |
11 | | - |
12 | | -if (file_exists(__DIR__ . $ds . 'config.php') === false) { |
| 10 | +if (!file_exists(__DIR__ . '/config.php')) { |
13 | 11 | Flight::halt(500, 'Config file not found. Please create a config.php file in the app/config directory to get started.'); |
14 | 12 | } |
15 | 13 |
|
16 | 14 | // this has to be hard code required because autoload hasn't been registered yet. |
17 | | -require_once __DIR__ . $ds . '..' . $ds . 'utils' . $ds . 'CustomFlight.php'; |
| 15 | +require_once __DIR__ . '/../utils/CustomFlight.php'; |
18 | 16 |
|
19 | 17 | // It is better practice to not use static methods for everything. It makes your |
20 | 18 | // app much more difficult to unit test easily. |
|
25 | 23 | * P.S. When you require a php file and that file returns an array, the array |
26 | 24 | * will be returned by the require statement where you can assign it to a var. |
27 | 25 | */ |
28 | | -$config = require __DIR__ . $ds . 'config.php'; |
| 26 | +$config = require __DIR__ . '/config.php'; |
29 | 27 | $app->set('config', $config); |
30 | 28 |
|
31 | 29 | // Whip out the ol' router and we'll pass that to the routes file |
|
38 | 36 | * When someone hits that URL, you point them to a function or method |
39 | 37 | * that will handle the request. |
40 | 38 | */ |
41 | | -require_once __DIR__ . $ds . 'routes.php'; |
| 39 | +require_once __DIR__ . '/routes.php'; |
42 | 40 |
|
43 | 41 | /* |
44 | 42 | * You additionally could just define the routes in this file. It's up to you. |
|
63 | 61 | * That's a discussion for another day. Suffice to say, that Flight has a basic concept |
64 | 62 | * of a services container by registering classes to the Engine class. |
65 | 63 | */ |
66 | | -require_once __DIR__ . $ds . 'services.php'; |
| 64 | +require_once __DIR__ . '/services.php'; |
67 | 65 |
|
68 | 66 | // At this point, your app should have all the instructions it needs and it'll |
69 | 67 | // "start" processing everything. This is where the magic happens. |
|
0 commit comments