PHP Classes

File: autoloader.php

Recommend this page to a friend!
  Classes of AlexanderC   PStorage   autoloader.php   Download  
File: autoloader.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: PStorage
Store and retrieve objects in flat files
Author: By
Last change: Update of autoloader.php
Date: 11 months ago
Size: 376 bytes
 

Contents

Class file image Download
<?php
/**
 * @author AlexanderC
 */

spl_autoload_register(function ($class) {
   
$path = __DIR__ . '/lib/';

   
$parts = explode("\\", $class);

    if(
count($parts) <= 0 || $parts[0] !== "PStorage") {
        return
false;
    }

   
array_shift($parts);

   
$file = realpath($path . implode("/", $parts) . ".php");

    return
is_file($file) ? require $file : false;
});