Skip to content

Instantly share code, notes, and snippets.

@galvao
Created July 22, 2014 18:03
Show Gist options
  • Select an option

  • Save galvao/cfd9b924cf04c7658b5a to your computer and use it in GitHub Desktop.

Select an option

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.
<?php
$loader = require_once 'vendor/autoload.php';
if (!in_array('ModuleName', array_keys($loader->getPrefixes()))) {
$loader->add("ModuleName", "/path/to/module");
}
@galvao
Copy link
Author

galvao commented Oct 23, 2014

@kinncj:

$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