Class "ModulesAdminModuleProvidersAdminModuleServiceProvider" not found is an error I’m encountering when I create a module in Laravel called AdminModule.
When I attempted to utilize the composer dump auto-load command, I also encountered issues like
Script @php artisan package:discover –ansi handling the post-autoload-dump event returned with error code 1
2
Answers
Check the composer auto-load. If you think all autoloads are correct, send your composer.
The error you’re encountering mostly occurs when Laravel cannot find the class or file for your module’s service provider due to one of the following issues:
Make sure the namespace in your
AdminModuleServiceProvider
matches thedirectory structure and the module’s PSR-4 autoload configuration in
composer.json
.Modules/AdminModule/Providers/AdminModuleServiceProvider.php
, the namespace must matchModulesAdminModuleProviders
.composer.json
file includes the module’s namespace in theautoload
section:composer.json,
run:config/app.php
(if applicable) ormodules_statuses.json
file:composer dump-autoload
again, ensuring no syntax or path errors exist in the project.Check
composer.json
for post-autoload scripts that might be failing:Debugging Steps
AdminModuleServiceProvider.php
.autoload
configuration incomposer.json
.