Views are not classes and thus cannot be autoloaded with psr-0
Take another look at the repository you linked to. The views folder is not under the namespace but still in the default location for Laravel.
Because composer supports psr-4 this task of being able to autoload new classes becomes much easier. You can keep the default Laravel directory structure and change the autoload section in the composer.json to the following.
"psr-4": {
"Acme\\Blog\\Controllers\\": "app/controllers",
"Acme\\Blog\\Models\\": "app/models"
},
You can also add migrations, seeds, tests, etc as well if you put those under the same namespace.
Thanks for your reply, but I found a solution.
Create a service provider to module and add namespace to view, just like like that:
\View::addNamespace('NamespaceModule', __DIR__ . '/../Views');
And make view like that:
return \View::make('NamespaceModule::module.index');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community