Skip to content

Instantly share code, notes, and snippets.

@AndrewChamp
Last active December 24, 2018 06:11
Show Gist options
  • Save AndrewChamp/4053e080a59ba71a8804 to your computer and use it in GitHub Desktop.
Save AndrewChamp/4053e080a59ba71a8804 to your computer and use it in GitHub Desktop.
PHP Autoloader - Includes files for classes that are instantiated.
<?php
spl_autoload_register(function($class){
$directorys = array(PATH.VERSION.MODULES, INSTALL.MODULES, INSTALL.THEME.'modules/');
foreach($directorys as $directory):
if(file_exists($directory.'class.'.$class.'.php')):
require($directory.'class.'.$class.'.php');
return;
endif;
endforeach;
});
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment