PHP Classes

File: autoloader.php

Recommend this page to a friend!
  Classes of Stefan Kientzler   PHP Web Push Notifications Server   autoloader.php   Download  
File: autoloader.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Web Push Notifications Server
Queue and push notifications to Web users
Author: By
Last change: fixes after set phpstan level 7
Date: 2 years ago
Size: 666 bytes
 

Contents

Class file image Download
<?php
spl_autoload_register
(function($strFullQualifiedClassName) {
   
$strInclude = '';
    if (
strpos($strFullQualifiedClassName, '\\') > 1) {
       
// replace the namespace prefix with the base directory, replace namespace
        // separators with directory separators in the relative class name, append
        // with .php
       
$strInclude = str_replace('\\', DIRECTORY_SEPARATOR, $strFullQualifiedClassName) . '.php';
    }

   
// if the file exists, require it
   
if (strlen($strInclude) > 0) {
       
$strInclude = dirname(__FILE__) . '/' . $strInclude;
        if (
file_exists($strInclude)) {
            require
$strInclude;
        }
    }
});