I have created an app/modules
directory and autoloaded it using PSR-4 like this:
"psr-4": {
"Modules\\": "app/modules"
}
And I also did composer dumpautoload
. I have the following directory structure:
app
- ...
- modules
-- ModuleName
--- controllers
---- BackendController.php
...
The file BackendController.php
has the namespace Modules\ModuleName\Controllers
.
And in routes.php
, I have the following:
Route::resource('backend/modules/module-name', 'Modules\ModuleName\Controllers\BackendController');
But whenever I try to access 'backend/modules/module-name', I get a ReflectionException
with the following message:
Class Modules\ModuleName\Controllers\BackendController does not exist
What may be causing the problem? When I run it in my local machine, it seems to work, but I can't get it to work on the webserver. Are there any server configuration scenarios, that may be causing this problem?
Since I don't have shell access to that webserver, I don't have composer installed on the webserver but it is installed on my local machine. I have uploaded all the files including vendor
directory, to the server.
controllers
folder toControllers
. – Burgomaster