Skip to content

Instantly share code, notes, and snippets.

@woutsanders
Forked from adriengibrat/l.php
Last active Aug 29, 2015
Embed
What would you like to do?
A very quick PSR-0 SPL autoloader function
<?php
//set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__); // optional
spl_autoload_register(function ($class) {
$file = preg_replace('#\\\|_(?!.+\\\)#','/', $class) . '.php';
if (stream_resolve_include_path($file)) {
require $file;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment