PHP Classes

File: app/config/bootstrap.php

Recommend this page to a friend!
  Classes of John Marlo Factorin   Bit Framework   app/config/bootstrap.php   Download  
File: app/config/bootstrap.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: Bit Framework
MVC based Web application development framework
Author: By
Last change: Update of app/config/bootstrap.php
Date: 2 days ago
Size: 617 bytes


Class file image Download

use Snipworks\BitCore\Inflector;

spl_autoload_register(function ($class) {
    if (
Inflector::ends('Controller', $class)) {
$dir = 'app/controllers';
    } elseif (
Inflector::ends('Service', $class)) {
$dir = 'app/services';
    } else {
$dir = 'app/models';

$path = sprintf('%s/%s.php', $dir, $class);
    if (!
file_exists(__ROOT__ . $path)) {
        throw new
BitException(sprintf('[Autoload] Class %s not found (path: %s)', $class, $path));

/** @noinspection PhpIncludeInspection */
require_once(__ROOT__ . $path);