Created
September 30, 2016 08:36
-
-
Save Taluu/03cc7cca3f9a61add432202663024b34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// in POST_AUTOLOAD_DUMP | |
$map = include('autoload_classmap.php'); | |
// TODO lowercase all keys | |
file_put_contents('autoload_classmap_insentitive.php', '<?php return '.var_export($map, 1)); | |
// at RUNTIME | |
require 'vendor/autoload.php'; | |
spl_autoload_register(function ($class) { | |
$map = include('autoload_classmap_insentitive.php'); | |
if (isset($map[$class = strtolower($class)])) { | |
require $map[$class]; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment