index.php 982 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. ini_set('display_errors', 1);
  3. ini_set('display_startup_errors', 1);
  4. error_reporting(E_ALL);
  5. if (PHP_SAPI == 'cli-server') {
  6. // To help the built-in PHP dev server, check if the request was actually for
  7. // something which should probably be served as a static file
  8. $file = __DIR__ . $_SERVER['REQUEST_URI'];
  9. if (is_file($file)) {
  10. return false;
  11. }
  12. }
  13. require __DIR__ . '/../vendor/autoload.php';
  14. if (!defined('FRONTEND')) {
  15. define('FRONTEND', false);
  16. }
  17. // Instantiate the app
  18. $settings = require __DIR__ . '/../src/settings.php';
  19. $local_settings = require __DIR__ . '/../src/settings-local.php';
  20. $app = new \Slim\App(array_replace_recursive($settings, $local_settings));
  21. // Set up dependencies
  22. require __DIR__ . '/../src/dependencies.php';
  23. // Register middleware
  24. require __DIR__ . '/../src/middleware.php';
  25. // Register routes
  26. foreach (glob(__DIR__ . "/../src/routes/*.php") as $filename) {
  27. require $filename;
  28. }
  29. // Run app
  30. $app->run();