Boilerplate to use a Directus Instance to Build a Custom Website, Content will be Manage by Directus
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.

36 lines
1.0 KiB

  1. <?php
  2. // adding functions
  3. require_once(__DIR__.'/Functions/Blade.php');
  4. // adding env
  5. $dotenv = Dotenv\Dotenv::createImmutable(__DIR__.'/../');
  6. $dotenv->load();
  7. // display all errors if debug is true
  8. if ($_ENV['APP_DEBUG'] === true) {
  9. error_reporting(E_ALL);
  10. ini_set('display_errors', 1);
  11. }
  12. // create app
  13. $flight = Flight::app();
  14. // setting view path
  15. $flight->set('flight.views.path', __DIR__.'/../resources/views');
  16. // adding blade for templates
  17. $flight->register('view', 'Jenssegers\Blade\Blade', [ $flight->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. $flight->set('basePath', __DIR__.'/../');
  23. $flight->set('publicPath', __DIR__.'/../public');
  24. $flight->set('storagePath', __DIR__.'/../storage');
  25. // adding pirectus
  26. $flight->register('pirectus', 'Pirectus\Pirectus', [ $_ENV['DIRECTUS_API_URL'], [
  27. 'auth' => new \Pirectus\Auth\TokenAuth($_ENV['DIRECTUS_API_TOKEN'])
  28. ]
  29. ]);