call_user_func(function () {
$composerLoader = require_once __DIR__ . '/vendor/autoload.php';
$loader = new Phalcon\Loader();
$loader->registerNamespaces($composerLoader->getPrefixesPsr4(), true);
$loader->registerNamespaces($composerLoader->getPrefixes(), true);
$loader->registerClasses($composerLoader->getClassMap(), true);
$loader->register();
var_dump($composerLoader->getPrefixesPsr4());
$loader->autoLoad('WeChat\\Utils');
});
when i execute php _loader.php
the output is
array(10) {
["WeChat\"]=>
array(1) {
[0]=>
string(39) "/Users/ian/Documents/prolove/src/WeChat"
}
["Symfony\Component\Yaml\"]=>
array(1) {
[0]=>
string(48) "/Users/ian/Documents/prolove/vendor/symfony/yaml"
}
["React\Promise\"]=>
array(1) {
[0]=>
string(53) "/Users/ian/Documents/prolove/vendor/react/promise/src"
}
["Predis\"]=>
array(1) {
[0]=>
string(53) "/Users/ian/Documents/prolove/vendor/predis/predis/src"
}
["Phalcon\"]=>
array(1) {
[0]=>
string(69) "/Users/ian/Documents/prolove/vendor/phalcon/incubator/Library/Phalcon"
}
["GuzzleHttp\Stream\"]=>
array(1) {
[0]=>
string(58) "/Users/ian/Documents/prolove/vendor/guzzlehttp/streams/src"
}
["GuzzleHttp\Ring\"]=>
array(1) {
[0]=>
string(58) "/Users/ian/Documents/prolove/vendor/guzzlehttp/ringphp/src"
}
["Elasticsearch\"]=>
array(1) {
[0]=>
string(81) "/Users/ian/Documents/prolove/vendor/elasticsearch/elasticsearch/src/Elasticsearch"
}
["Doctrine\Instantiator\"]=>
array(1) {
[0]=>
string(83) "/Users/ian/Documents/prolove/vendor/doctrine/instantiator/src/Doctrine/Instantiator"
}
["App\"]=>
array(1) {
[0]=>
string(36) "/Users/ian/Documents/prolove/src/App"
}
}
Notice: Array to string conversion in /Users/ian/Documents/prolove/_loader.php on line 16
and I found the $loader->registerNamespace accept only
array(
'namespace'=>'path'
)
not the composer's
array(
'namespace'=>array('path1', 'path2')
)
Is this a problem?