Skip to content

Instantly share code, notes, and snippets.

@Taluu
Created September 30, 2016 08:36
Show Gist options
  • Save Taluu/03cc7cca3f9a61add432202663024b34 to your computer and use it in GitHub Desktop.
Save Taluu/03cc7cca3f9a61add432202663024b34 to your computer and use it in GitHub Desktop.
<?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