Composer uses psr-4 to automatically load classes, why can't you find them?

I usually put my local package in classmap before.
watched a video two days ago. The more standard way to write it is to put it in psr-4.

after writing into this, the class cannot be found;

"autoload": {
        "classmap": [
            "database/seeds",
            "database/factories",
            "vendor/jormin/laravel-ddoc",
            "vendor/jormin/laravel-kdniao",
            "vendor/xdstack/ip2location",
            "vendor/overtrue/weather"
        ],
        "psr-4": {
            "App\\": "app/",
            "Jeffcott\\express\\": "packages/jeffcott/express/src",
            "Jeffcott\\clear\\": "packages/jeffcott/clear/src/",
            "Jeffcott\\Weather\\": "packages/jeffcott/weather/src",
            "Jeffcott\\chinese-calendar\\": "packages/jeffcott/chinese-calendar/src"
        }
    },

clipboard.png

:

clipboard.png

clipboard.png

ask for help;

Jun.04,2021

the landlord probably doesn't quite understand the loading mechanism

you can refer to https://codeshelper.com/a/11.

.

using the psr4 standard to implement automatic loading, there are two possibilities if it is not successful:
1 there is a problem with the array of psr4 in the composer. Json;
2, after writing the array of psr4, composer dump-autoload; is not executed to generate the autoload file;

psr4 has no problem, so check to see if composer-autoload, has the package composer/composer; the elements in the psr4 array will be mapped to the autoload_psr4.php file, through which the corresponding class can be found.

clipboard.png


does app/Http/Controllers/Weather.php have this file?

Menu