PHP Classes

File: fox/autoload.php

Recommend this page to a friend!
  Classes of Joubert RedRat   Fox micro framework   fox/autoload.php   Download  
File: fox/autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Fox micro framework
Model View Controller micro-framework
Author: By
Last change: Update of fox/autoload.php
Date: 1 year ago
Size: 546 bytes
 

Contents

Class file image Download
<?php
/**
 * Autolader engine
 *
 * @author Joubert <eu+fot@redrat.com.br>
 * @license: MIT
 * @see https://github.com/joubertredrat/fox/
 */

namespace Fox;

$composer_autoload = getValidPath(FOX_PATH, '..', 'vendor', 'autoload.php');
if (
file_exists($composer_autoload)) {
    require(
$composer_autoload);
}

spl_autoload_register(function ($class) {
    if (
strpos($class, __NAMESPACE__.'\\Model\\') === 0) {
       
$name = substr($class, strlen(__NAMESPACE__.'\\Model\\'));
        require(
getValidPath(MODEL_PATH, $name.'.php'));
    }
});