nWidart / laravel-modules

Module Management In Laravel

Home Page:https://docs.laravelmodules.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Class "Modules\Admin\Providers\AdminServiceProvider" not found

ksaif121786 opened this issue · comments

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
12
4.composer dump-autoload
5.php artisan module:make Blog
then:
Class "Modules\Blog\Providers\BlogServiceProvider" not found
13

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:

  1. laravel new website (v11) & artisan migrate
  2. composer require nwidart/laravel-modules & vendor:publish
  3. update extra in composer.json
    12
    ...

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?
image

I have the same problem with v11 any solutions? image

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": "n.widart@gmail.com"
        }
    ],
    "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.
image

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: solomonochepa@gmail.com

same error for me

To Fix This Issue
Please update extra in composer.json :

extra

Run Command : composer dump-autoload