PHP Classes

File: autoload.php

Recommend this page to a friend!
  Classes of Sriram   Basic PHP Bulk Email Queue System   autoload.php   Download  
File: autoload.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Basic PHP Bulk Email Queue System
Queue messages in a database to be delivered later
Author: By
Last change:
Date: 3 years ago
Size: 1,120 bytes
 

Contents

Class file image Download
<?php
/*
 * AngeldromeLibs, Some Base classes that could be reused for app development.
 *
 * Autoloader for classes and methods, that are evoked in this namespace.
 *
 * @author Sriram R <srishere@angeldrome.com>
 * @copyright 2020 Sriram R
 * @license This code is licensed under MIT license (see LICENSE.txt for details)
 * @version CVS: $Id:$
 * @link http://www.angeldrome.com
 */
    //let these guys be here, till some good approach is established
       
session_start();
       
date_default_timezone_set('UTC');
       
//error_reporting(0);
    //end of core phpsetting


spl_autoload_register(function ($className) {
   
$parts = explode("\\", $className);
    if(
$parts[0] == "Com" && $parts[1] == "Angeldrome") {
        if (
sizeof($parts) > 2) {
           
$class = $parts[sizeof($parts) - 1];
           
$path = "src/";
            for (
$pind = 0; $pind < (sizeof($parts) - 1); $pind++) {
               
$path .= $parts[$pind] . "/";
            }
           
$class = $path.$class;
        } else {
           
$class = $parts[0];
        }
        require
$class.".php";
    }
});