简体   繁体   中英

Laravel 4, Composer, PSR-0 Autoloading Issues

I'm experiencing a weird problem with a package I'm developing in the workbench. It involves this little peice of my Composer file:

"psr-0": {
    "Vendor\\": "src/"
}

What I'm wanting to do is change the path like this:

"psr-0": {
    "Vendor\\": "src/models/"
}

Laravel has problems with this. The classes get added to my application just fine, but all Laravel pathing to package resources get jacked up.

Things like this:

View::make('package::myview')
Config::get('package::myvars')

These do not work at all. I get errors like this:

No hint path defined for [packge]

But if I remove the "models/" from the PSR-0 path then it all works fine.

So basically, it looks like Laravel insists that my Composer file have only "src/" in my PSR-0 paths.

This is a bug or am I missing something?

Laravel假定Provider文件向下两级,但是您可以在注册软件包时手动设置src/的路径:

$this->package('vendor/package', null, __DIR__.'/../../../');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM