Reputation: 1951
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?
Upvotes: 5
Views: 22141
Reputation: 1
first of all you need to clear the cache of your project by this code
php artisan config:cache
and then you need to enter this code in the terminal (for facebook for example)
composer require socialiteproviders/facebook
in the previous line i ended it with facebook as an example but you could change it like instagram or anything else and the error will be solved
Upvotes: 0
Reputation: 8135
At first of all, check if your socialite package is compatible with your Laravel version.
You can verify your Laravel version inside your Laravel path, for it type:
$ php artisan --version
Then, check in the socialite Git repository (link below) a compatible version with your Laravel.
https://github.com/laravel/socialite/releases
Now install the socialite package with composer require laravel/socialite x.x
(where x.x is your socialite choosed version)
Lastly add the following lines in config/app.php file
inside 'providers' => [
Laravel\Socialite\SocialiteServiceProvider::class,
and almost at the end of the file, inside 'aliases' => [
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
Save the file.
Upvotes: 0
Reputation: 21
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,
Upvotes: 2
Reputation: 1717
first of all remove the line
Laravel\Socialite\SocialiteServiceProvider::class,
and also
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
from Config\app.php and update the composer by adding
"laravel/socialite": "^2.0"
and after that add these two line in Config\app.php it will work because when you add these lines before updating composer it goes to vender folder and search for the SocialiteProvider but it is not available yet so when you will update composer first and then add these lines it will work fine
Upvotes: 1
Reputation: 6301
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.
Upvotes: 3