In my project, I'm including a package I'm developing, which has a composer.json, which includes the following autoload entry:
(censored to not get in trouble with my company of course)
{
"autoload": {
"psr-4": {
"Vendor\\Package\\": "src/Package"
}
}
}
The main project and the package both have a composer.json, this is from the package's composer.json
I have also seen some examples that only used "Vendor\\", but this resulted in the exact same issue.
I am requiring the package on version tag (from a git repository), so it should get and install the package correctly.
Any time composer runs autoload, it complains the namespaces don't conform to PSR-4. I have checked the capitalisation, which all checks out. It complains about pretty much every php file in my project. Here's an example of the file structure:
vendor
|- package
|- src
|- Package
|- PackageServiceProvider.php
The namespace of PackageServiceProvider.php is Vendor\Package
, and the class is PackageServiceProvider
.
As far as I know, this is how it's supposed to be. Yet composer still gives the deprecation notice.
I should probably mention that I have also tried running composer clearcache
between all of the things I've tried (which are mainly changing capitalisation), which didn't help.
I am completely out of ideas on how to fix this.
I'm on composer version 1.10.13, and Laravel version 5.8.38.
One of the many deprecation notices I'm getting:
Deprecation Notice: Class Vendor\Package\PackageServiceProvider located in D:/wwwroot/project/vendor/{package-vendor}/package/src/Package\PackageServiceProvider.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/Users/me/AppData/Local/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201