laravel-modules
laravel-modules copied to clipboard
Class "Modules\Admin\Providers\AdminServiceProvider" not found
showing me this Class "Modules\Admin\Providers\AdminServiceProvider" not found and composer dump-autoload not working
https://github.com/nWidart/laravel-modules?tab=readme-ov-file#autoloading
try to update this part, i successful solve this issue on my latest pull.
I have encountered the same situation with laravel 11. Have you resolved it?
my step:
1.laravel new website (v11) & artisan migrate
2.composer require nwidart/laravel-modules & vendor:publish
3.update extra in composer.json
4.composer dump-autoload
5.php artisan module:make Blog
then:
Class "Modules\Blog\Providers\BlogServiceProvider" not found
Can you share a screenshot of your module's composer.json
, module.json
and the provider class?
I have encountered the same situation with laravel 11. Have you resolved it?
my step:
- laravel new website (v11) & artisan migrate
- composer require nwidart/laravel-modules & vendor:publish
- update extra in composer.json
...
Your main composer.json
file is okay.
Can you share a screenshot of your module's
composer.json
,module.json
and the provider class?
It is currently running normally, it is my own problem. opcache setting error. thanks.
I have the same problem with v11
any solutions?
I have the same problem with v11 any solutions?
Check your module composer.json, module.json and the Service Provider itself. Compare the value of the namespace in each of the files.
Lastly, try run composer dump-autoload
@solomon-ochepa i ran composer dump-autoload
modules composer :
{
"name": "nwidart/user",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "[email protected]"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\User\\": "app/",
"Modules\\User\\Database\\Factories\\": "database/factories/",
"Modules\\User\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\User\\Tests\\": "tests/"
}
}
}
module.json:
{
"name": "User",
"alias": "user",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\User\\Providers\\UserServiceProvider"
],
"files": []
}
i even added psr-4 to composer to make sure and ran it all again.
by the way this is out of the box and according to documentation. didn't change anything yet
Could you remove the addition at line 30 from the module's composer.json
(image above)?
Please ensure the main composer.json
doesn't include the modules in its autoload.psr-4 section.
If the problem persists, please feel free to reach out for direct support. To assist you effectively, I would need limited access to your code.
WhatsApp: https://wa.me/2348162682618, Telegram: https://t.me/solomon_ochepa, Email: [email protected]
same error for me
To Fix This Issue Please update extra in composer.json :
Run Command : composer dump-autoload