PHP Classes

File: public/index.php

Recommend this page to a friend!
  Classes of Adrian M   PHP CRUD API Generator   public/index.php   Download  
File: public/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CRUD API Generator
Create an API to access MySQL database record
Author: By
Last change:
Date: 1 month ago
Size: 414 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

require_once
__DIR__ . '/../vendor/autoload.php';

use
App\Database;
use
App\Router;
use
App\Authenticator;

// Load configs
$dbConfig = require __DIR__ . '/../config/db.php';
$apiConfig = require __DIR__ . '/../config/api.php';

// Bootstrap
$db = new Database($dbConfig);
$auth = new Authenticator($apiConfig);
$router = new Router($db, $auth);

// Dispatch
$router->route($_GET);