Laravel, using packages with PSR-4, gives the message "No hint path defined for"

Im uses Laravel 4.1 and runs a package (subby) that uses the PSR-4 standard. When I try to do any kind with:

return View::make('subby::user.login');

I get a message:

No hint path defined for [subby]

I have a lot of red things, but usually these are typos problems.

+4
source share
1 answer

The problem is the use of PSR-4 Since Laravel is PSR-0 by default, it assumes that the resources (views, etc.) of the Package will be 2 levels higher than that of the service provider. Example:

src
├── config
├── lang
├── migrations
├── Ghunti
│   └── Subby
│       └── SubbyServiceProvider.php
├── routes.php
└── views
    └── user
        └── login.blade.php

PSR-4 ( "No hint path for defined for":

src
├── config
├── lang
├── migrations
├── SubbyServiceProvider.php
├── routes.php
└── views
    └── user
        └── login.blade.php

, boot() , :

public function boot()
{
    $this->package('ghunti/subby');
}

( )

public function boot()
{
    //For PSR-4 compatibility we need to specify the correct path (3rd parameter)
    $this->package('ghunti/subby', null, __DIR__);
}
+14

Source: https://habr.com/ru/post/1529710/


All Articles