Last active
February 12, 2016 16:01
-
-
Save AndrewCarterUK/ecb36fd7ba995f7697a8 to your computer and use it in GitHub Desktop.
Class "preloading" with Composer
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 | |
/* | |
This should work because composer registers a callback using | |
'spl_autoload_register' for when a class is used that has not | |
already been loaded. Loading the class before hand will | |
prevent that callback being triggered by PHP. | |
*/ | |
/** @var Composer\Autoload\ClassLoader **/ | |
$classLoader = include 'vendor/autoload.php'; | |
$classLoader->loadClass('Path\\To\\MyClass'); | |
$classLoader->loadClass('Path\\To\\OtherClass'); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment