Laravel5 Class 'Laravel\Socialite\SocialiteServiceProvider' not found

brazorf picture brazorf · Sep 14, 2015 · Viewed 15.3k times · Source

I've added

"laravel/socialite": "~2.0"

as a composer dependency, and i've added the service provider in my config/app.php just like this

'providers' => [
    // more providers
    'Laravel\Socialite\SocialiteServiceProvider'
]

Then, when i access to any of my application route, i've got this Class 'Laravel\Socialite\SocialiteServiceProvider' not found exception.

Looking into my vendor/composer/autoload_psr4.php i see there's not the Socialite mapping - ive ran composer update and composer dump-autoload more than once.

What's wrong?

Answer

ollieread picture ollieread · Sep 14, 2015

Did you run the composer command before adding the provider to the file? If not, this can sometimes cause issues.

I recommend removing the reference from the config file and the composer.json, then running composer request laravel/socialite 2.0. Also, just fyi, using the ::class notation in the providers listing will help if you're using a full IDE like phpstorm, as it will highlight when it can't find the class.