Reputation:
Regarding to PSR-0 standards it says each class must have a namespace.
So, is it necessary that controllers must be in namespace as well?
Upvotes: 1
Views: 260
Reputation: 219920
If you want your controllers to be PSR-0 compliant, then they have to be namespaced.
Laravel makes it super easy to use a single namespace for all your controllers, without having to set it manually on every route:
Route::group(['namespace' => 'ACME\Controllers', function ()
{
// Routes to: ACME\Controllers\Home@index
Route::get('/', 'Home');
// Routes to: ACME\Controllers\Admin@orders
Route::get('admin/orders', 'Admin@orders');
}]);
Upvotes: 4