Im using Laravel 4.1 and starting a package (subby) that is using PSR-4 standard. When I try to render any view with:
return View::make('subby::user.login');
I get the message:
No hint path defined for [subby]
I've red many things, but those were usually typo problems
The problem is in the usage of the PSR-4 Since Laravel default is PSR-0 it assumes that the resources (views etc) of a package will be 2 levels up from where the package service provider is. Ex:
src
├── config
├── lang
├── migrations
├── Ghunti
│ └── Subby
│ └── SubbyServiceProvider.php
├── routes.php
└── views
└── user
└── login.blade.php
With PSR-4 the package service provider and the views will be at the same level (and the error "No hint path defined for" will show up:
src
├── config
├── lang
├── migrations
├── SubbyServiceProvider.php
├── routes.php
└── views
└── user
└── login.blade.php
To fix this, on the package service provider boot()
method, instead of:
public function boot()
{
$this->package('ghunti/subby');
}
we need to specify the resources path (the 3rd parameter)
public function boot()
{
//For PSR-4 compatibility we need to specify the correct path (3rd parameter)
$this->package('ghunti/subby', null, __DIR__);
}