我有一个使用作曲家在Silex应用程序中加载班级的情况。作曲家自动加载不在Silex中的班级
该类位于:
src/custom/UserProvider.php
在我composer.json,我已经添加了此行:
"autoload": {
"psr-0": {
"CustomNamespace": "src/custom/"
}
}
里面我UserProvider.php文件,我已经有了:
namespace CustomNamespace;
当我在控制台中运行作曲家更新时,此行被添加ED的/vendor/composer/autoload_namespaces.php
'CustomNamespace' => $baseDir . '/src/custom/',
但是,当我尝试使用类:
new CustomNamespace\UserProvider();
我得到这个错误:
Fatal error: Class 'CustomNamespace\UserProvider' not found in /home/ubuntu/www/project/web/index.php on line 27
有谁知道这是怎么回事?谢谢!
是名为src/custom/CustomNamespace/UserProvider.php的文件吗? – Maerlyn 2013-02-18 07:11:16
hm ...我要试试这个! – joaobarbosa 2013-02-18 13:58:54