Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel5 Class 'Laravel\Socialite\SocialiteServiceProvider' not found

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?

like image 576
brazorf Avatar asked Sep 14 '15 10:09

brazorf


2 Answers

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.

like image 141
ollieread Avatar answered Oct 06 '22 03:10

ollieread


I have removed the reference from the config file and the composer.json, then ran composer require laravel/socialite 2.0 instead of composer request laravel/socialite 2.0.

Then add the following lines to the config file

Laravel\Socialite\SocialiteServiceProvider::class,

and

'Socialite' => Laravel\Socialite\Facades\Socialite::class,
like image 40
Vervaak Lai Avatar answered Oct 06 '22 02:10

Vervaak Lai