PHP Classes

File: public/index.php

Recommend this page to a friend!
  Classes of Ujah Chigozie peter   Luminova REST API Example   public/index.php   Download  
File: public/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Luminova REST API Example
Implements an example of a REST API
Author: By
Last change:
Date: 17 days ago
Size: 1,275 bytes
 

Contents

Class file image Download
<?php
/**
 * Luminova Framework Index front controller.
 *
 * @package Luminova
 * @author Ujah Chigozie Peter
 * @copyright (c) Nanoblock Technology Ltd
 * @license See LICENSE file
*/
declare(strict_types=1);

use \
Luminova\Boot;
// use \Luminova\Routing\Prefix;
// use \App\Controllers\Errors\ViewErrors;

require_once __DIR__ . '/../system/Boot.php';

/**
 * Ensure that we are in front controller while running script in cli mode
 */
if (getcwd() . DIRECTORY_SEPARATOR !== FRONT_CONTROLLER) {
   
chdir(FRONT_CONTROLLER);
}

/**
 * FOR ATTRIBUTE ROUTING
 *
 * Load application route context based on PHP attribute routing.
 */
Boot::http()->router->context()->run();

/**
 * FOR NON ATTRIBUTE ROUTING
 *
 * Load application route context based on method-based routing.
 * Uncomment this below code if using method-based routing (Non-Attribute).
 *
 * @see /routes/web.php - Main web-pages routes
 * @see /routes/api.php - APIs routes
 * @see /routes/cli.php - CLI routes
 */
/*
Boot::http()->router->context(
    [
        'prefix' => Prefix::WEB,
        'error' => [ViewErrors::class, 'onWebError']
    ],
    [
        'prefix' => Prefix::API,
        'error' => [ViewErrors::class, 'onRestError']
    ],
    [
        'prefix' => Prefix::CLI
    ]
)->run();*/