I am facing the below error on running the composer dumpautoload
.
Deprecation Notice: Class App\Support\Dataviewer located in ./app/Traits/DataViewerTraits.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
Class App\Support\Dataviewer
is where I am applying some logic for filters.
in my composer.json
"autoload": {
"psr-4": {
"App\\": "app/",
"Support\\": "app/Support",
"Traits\\": "app/Traits"
},
"classmap": [
"database/seeds",
"database/factories",
"app/Models"
]
},
what am I doing wrong here?
Ok was looking for the answer all over the place and stumbed upon the below issue link on github for composer: https://github.com/composer/composer/issues/8465
the second last comment is what was needed for me to do. instead of adding the files in psr-4 section
, I added it to classmap
section, and voila: its done :D
First you're setting all inside app/
as App\\
namespace and then setting app/Support
and app\Traits
with a different namespace.
You should either move Support and Traits to the root folder or remove those namespaces from composer.json
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.