Ad

Composer Downloads The Package And Put In The Vendor Map But The Service Provider Doesn't Recognize It Laravel 6

- 1 answer

I forked an api handler from git that I need to update to be laravel 6 (api handler that i forked what is not laravel 6 compatible) compatible but I keep getting composer errors

So when I run composer update it install the package from the git and put it correctly on in the vendor folder. what works fine then I add the class to the config/app.php like this

'providers'       => [
    Name\ApiHandler\ApiHandlerServiceProvider::class,
],

what will throw this error in laravel

In ProviderRepository.php line 208:
Class 'Name\ApiHandler\ApiHandlerServiceProvider' not found

so far I have tried:

  1. composer clear-cache
  2. rm -rf .cache/composer/*
  3. clear the bootstrap composer
  4. delete composer.lock
  5. delete the vendor

and then after that composer update but it keeps throwing the error. But when I am in mine editor and go to the config/app.php and click on Name\ApiHandler\ApiHandlerServiceProvider::class, while holding ctrl it finds the class and goes to the vendor map so mine idea shows that the class is correctly imported

this is how the composer.json looks of the laravel project

"repositories": [
{
  "type":"package",
  "package": {
    "name": "name/laravel-api-handler",
    "version":"dev-laravel-6",
    "source": {
      "url": "https://github.com/name/laravel-api-handler",
      "type": "git",
      "reference":"branch name"
    }
  }
}
],
"require": {
  "name/laravel-api-handler": "dev-laravel-6",
},

the api handler composer.json

 "autoload": {
    "psr-4": {
        "name\\ApiHandler\\": "src"
    }
},
"extra": {
    "laravel": {
        "providers": [
            "name\\ApiHandler\\ApiHandlerServiceProvider"
        ]
    }
},

the map structure is vendor/name/laravel-api-handler/src

also the the custom package doesnt show up in the Discovered Package when running Composer update or Composer install

Am I missing something because I cant figure out what is going wrong

Ad

Answer

So after doing research to editing custom packages into your project apparently composer doesn't autoload "type":"package" what is not mentioned in there documentation anywhere. link where it get explained

Ad
source: stackoverflow.com
Ad