/
index.php
32 lines (23 loc) · 934 Bytes
/
index.php
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
<?php
declare(strict_types=1);
use PhpMicroframework\Application\Controller\ApiController;
use PhpMicroframework\Application\Core;
use PhpMicroframework\Framework\Problem;
use PhpMicroframework\Framework\Router;
require dirname(__DIR__) . '/vendor/autoload.php';
// Set error reporting level for development.
error_reporting(E_ALL | E_STRICT);
// This can be set in php.ini and removed here.
date_default_timezone_set('UTC');
// Enable error messages on 500 pages.
Problem::setDisplayErrorsEnabled(true);
// Register all PSR-4 namespaces where the framework should search for controllers.
// The framework will search in array order until the first controller match is found.
Router::$namespaces = [
'PhpMicroframework\\Application\\Controller',
];
// Set the demo controller and method as home page.
Router::$defaultController = ApiController::class;
Router::$defaultMethod = 'index';
// Run the framework.
Core::run();