Usually updating composer takes care of that, but of course make sure any package you install, your system meets the requirements meaning PHP version Etc.
Remember some packages depend on other packages, the requirements must match.
I'm currently updating an old Laravel app with some packages from 5.7 to 8. But I've run into warnings or errors such as:
Class Rocketlabs\Helpers\App\Models\Emailvalidator located in ./vendor/rocketlabs/helpers/src/app/Models/Emailvalidator.php does not comply with psr-4 autoloading standard. Skipping.
And I'm not sure what I'm doing wrong. I have a package at gitlab called rocketlabs/helpers.
Simpliefied file structure
composer.json
src
src/app/Models/Emailvalidator.php
And inside that file src/app/Models/Emailvalidator.php, I have the following namespace:
namespace Rocketlabs\Helpers\App\Models
My composer.json have the following:
{
"name": "rocketlabs/helpers",
"description": "Helper package",
"authors": [
{
"name": "",
"email": ""
}
],
"autoload": {
"psr-4": {
"Rocketlabs\\Helpers\\": "src"
},
},
"minimum-stability": "dev",
"extra": {
"laravel": {
"providers": [
"Rocketlabs\\Helpers\\HelpersServiceProvider"
]
}
}
}
If a kind soul could point me in the right direction I would really appreciate it. What am I missing?
@grenadecx Sometimes it's staring you in the face and you don't see it.
The capitalisation of every directory below the src/ directory must match the capitalisation of everything in the namespace and your example doesn't match.
Either make it a capital A App in the directory name or make it a lowercase a app in the namespace.
BTW: A lowercase a app in the namespace is just plain wrong.
Please or to participate in this conversation.