-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboostrap.php
More file actions
35 lines (25 loc) · 752 Bytes
/
boostrap.php
File metadata and controls
35 lines (25 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
use Matscode\Paystack\Paystack;
use Philo\Blade\Blade;
// require flightPHP
require 'vendor/autoload.php';
// load env variables.
(Dotenv\Dotenv::createImmutable(__DIR__))->safeLoad();
// register view rendering library/helper
$views = __DIR__ . '/views';
$cache = __DIR__ . '/cache';
$blade = new Blade($views, $cache);
Flight::map('view', function($view_name, $view_data = []) use ($blade){
echo $blade->view()->make($view_name, $view_data)->render();
});
// register paystack SDK
Flight::map('paystack', function (){
return new Paystack($_ENV['paystack_secret']);
});
// Load routes
$routes = require 'routes.php';
foreach ($routes as $route => $action) {
Flight::route($route, $action);
}
// start Flight
Flight::start();