You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
811 B

3 years ago
  1. <?php
  2. // adding functions
  3. require_once(__DIR__.'/Flight/Functions.php');
  4. // adding env
  5. $env = Dotenv\Dotenv::createImmutable(__DIR__.'/..');
  6. $env->load();
  7. // display all errors if debug is true
  8. if (getenv('DEBUG') === true) {
  9. error_reporting(E_ALL);
  10. ini_set('display_errors', 1);
  11. }
  12. // create app
  13. $app = Flight::app();
  14. // setting view path
  15. $app->set('flight.views.path', __DIR__.'/../resources/views');
  16. // adding blade for templates
  17. Flight::register('view', 'Jenssegers\Blade\Blade', [ $app->get('flight.views.path'), __DIR__.'/../storage/cache']);
  18. Flight::map('render', function($view, $data) {
  19. echo Flight::view()->make($view, $data);
  20. });
  21. // setting path
  22. $app->set('basePath', __DIR__.'/../');
  23. $app->set('publicPath', __DIR__.'/../public');
  24. $app->set('storagePath', __DIR__.'/../storage');