Created
July 22, 2014 18:03
-
-
Save galvao/cfd9b924cf04c7658b5a to your computer and use it in GitHub Desktop.
Make sure you only add your module's custom path to composer's autoloader once.
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 | |
| $loader = require_once 'vendor/autoload.php'; | |
| if (!in_array('ModuleName', array_keys($loader->getPrefixes()))) { | |
| $loader->add("ModuleName", "/path/to/module"); | |
| } |
Author
$loader = require_once 'vendor/autoload.php';
$loader->add("WIIS", "vendor/wiis/wiis/src");
$loader->add("WIIS", "vendor/wiis/wiis/src");
$loader->add("WIIS", "vendor/wiis/wiis/src");
$loader->add("WIIS", "vendor/wiis/wiis/src");
$loader->add("WIIS", "vendor/wiis/wiis/src");
var_dump($loader->getPrefixes());
die();
Result:
...
'WIIS' =>
array (size=5)
0 => string 'vendor/wiis/wiis/src' (length=20)
1 => string 'vendor/wiis/wiis/src' (length=20)
2 => string 'vendor/wiis/wiis/src' (length=20)
3 => string 'vendor/wiis/wiis/src' (length=20)
4 => string 'vendor/wiis/wiis/src' (length=20)
...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/composer/composer/blob/ac497feabaa0d247c441178b7b4aaa4c61b07399/src/Composer/Autoload/ClassLoader.php#L121