Created
September 30, 2016 08:23
-
-
Save Seldaek/f0be6a5267b56ed3ebbb410c1c826cec to your computer and use it in GitHub Desktop.
Case-insensitive Classmap
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
// in POST_AUTOLOAD_DUMP | |
$map = include('autoload_classmap.php'); | |
// TODO lowercase all keys | |
file_put_contents('autoload_classmap.php', '<?php return '.var_export($map, 1)); | |
// the above should be done without include ideally to keep the classmap using relative paths, | |
// but if you don't move the project files around then this is fine. | |
// at RUNTIME | |
$loader = require 'vendor/autoload.php'; | |
$loader->unregister(); | |
spl_autoload_register(function ($class) use ($loader) { | |
$loader->loadClass(strtolower($class)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment