PHP Classes

File: autoload.php

Recommend this page to a friend!
  Classes of Rafal Przetakowski   JSON Manager   autoload.php   Download  
File: autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: JSON Manager
Manipulate data structures loaded from JSON
Author: By
Last change:
Date: 8 years ago
Size: 549 bytes
 

Contents

Class file image Download
<?php

$vendors
= __DIR__.'/vendor/autoload.php';
if (
file_exists($vendors)) {
    require(
$vendors);
}

/**
* Registers an autoload for all the classes in Beeflow\\JsonManager
*/
spl_autoload_register(function ($className) {
   
$namespace = 'Beeflow\\JsonManager';

    if (
strpos($className, $namespace) === 0) {
       
$className = str_replace($namespace, '', $className);
       
$fileName = __DIR__ . '/' . str_replace('\\', '/', $className) . '.php';
        if (
file_exists($fileName)) {
            require(
$fileName);
        }
    }
});