Laravel Class 'Socialite' not found - laravel

Using composer, I have installed Socialite package to my local machine. It works well. Then I upload all the vendor/laravel/socialite directory as it is to server. Then on server, in composer.json added the line -
"laravel/socialite": "^2.0"
Also, in config/app.php make below changes -
In provider section add the line -
Laravel\Socialite\SocialiteServiceProvider::class,
In aliases section add this line -
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
Then, as per documentation add below code in config/services.php file -
'facebook' => [
'client_id' => '{{my_client_id}}',
'client_secret' => '{{my_secret_key}}',
'redirect' => 'http://mydomain/public/callback',
],
The Controller, I am using has included use Socialite; at top.
Bur now, it gives me error as Class 'Socialite' not found on server. Where as it works fine on my local machine.
Am I missing something to upload on server?
Your help is appreciated.
Thanks.

You need to do dump autoload everytime you make changes in composer.json, composer dump-auto

Related

In ProviderRepository.php line 208: Class 'Sentry\SentryLaravel\SentryLaravelServiceProvider' not found

I'm trying to install Sentry Error Tracking into my Laravel 5 Project. It throws an Error when i try publishing the Provider using the command
php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider"
I added this into config/app.php
'providers' => array(
// ...
Sentry\SentryLaravel\SentryLaravelServiceProvider::class,
)
'aliases' => array(
// ...
'Sentry' => Sentry\SentryLaravel\SentryFacade::class,
)
Then i ran
php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider"
And it threw the Error
In ProviderRepository.php line 208:
Class 'Sentry\SentryLaravel\SentryLaravelServiceProvider' not found
I've been searching for various solutions but none of them worked for me. This is very important for my project. Can i please please get some assistance. Thank You.
I recommend official sentry documentation.
https://sentry.io/for/laravel/
Not sure what is your exact development environment.(OS, PHP version, laravel version etc).
Here are something you can check.
check your installed sentry laravel package. If you did not install it, use next command to install.
composer require sentry/sentry-laravel
check version of sentry/sentry-laravel from composer.json.
Please notice after version 1.x namespace has been changed to
'providers' => array(
Sentry\Laravel\ServiceProvider::class,
)
'aliases' => array(
'Sentry' => Sentry\Laravel\Facade::class,
)
Namespace update
version 0.x
Sentry\SentryLaravel\SentryLaravelServiceProvider::class
https://github.com/getsentry/sentry-laravel/blob/0.10.1/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php
version 1.x
Sentry\Laravel\ServiceProvider::class
https://github.com/getsentry/sentry-laravel/blob/1.0.0/src/Sentry/Laravel/ServiceProvider.php

Class 'GuzzleHttp\Client' not found on Laravel production shared server

I'm trying to retrieve data from an API using Guzzle. I followed the steps in Guzzle website, installed it using composer, added the route and the code in a controller.
I tried these two options:
$client = new Client([
// Base URI is used with relative requests
'base_uri' => 'https://jsonplaceholder.typicode.com/',
// You can set any number of default request options.
'timeout' => 2.0,
]);
and...
$client = new \GuzzleHttp\Client([
// Base URI is used with relative requests
'base_uri' => 'https://jsonplaceholder.typicode.com/',
// You can set any number of default request options.
'timeout' => 2.0,
]);
When running I got the error...
Class 'GuzzleHttp\Client' not found.
I have tried:
require( dirname( __FILE__ ) . '/../../../vendor/autoload.php');
use GuzzleHttp\Client;
In composer.json:
"require": {
"guzzlehttp/guzzle": "^6.3",
...
},
Also...
composer update
composer dump-autoload
php artisan config:clear
The project is on shared hosting; I noticed that there was no Guzzle folder inside the /vendor folder, so I uploaded via FTP. But still the same error.
I've tried everything I found in the forum on this topic; I'm running out of ideas, please any advice would be appreciated.
Thanks in advance for your valuable help.
If you can't run composer on shared hosting, you should upload also /vendor/composer directory (after local $ composer require guzzlehttp/guzzle).

Laravel 5.5 Socialite Error

I have an issue with Socialite on Laravel 5.5 I have Socialite required by composer, updated services.php with different providers credential and updated providers in app.php This is the error I am getting
Type error: Argument 1 passed to Laravel\Socialite\SocialiteManager::formatRedirectUrl() must be of the type array, null given
Any help is highly appreciated.
In most of the cases, the issue is solved through 3 steps:
Run php artisan clear-compiled
Run composer dump-autoload
Run php artisan optimize
Hope it helps. Thanks.
Check config/services.php for the provider you're authenticating with. The redirect entry needs to be set to your defined route.
'redirect' => 'http://your-callback-url'
Example:
// config.services.php
'github' => [
'client_id' => env('GITHUB_CLIENT_ID'),
'client_secret' => env('GITHUB_CLIENT_SECRET'),
'redirect' => 'http://example.com/github/redirect',
],
// routes/web.php
Route::get('github/redirect', 'GitHubController#redirect')

How to install laravelcollective html in laravel 5 without using composer

I'm using laravel 5.5 and I want to install laravelcollective without using composer. I have followed steps mentioned in other questions to install it in laravel 5.2 but it is generating the following error.
Class Collective\Html\HtmlServiceProvider not found
Please suggest the possible reasons for the error.
Shashank Simha M R, I think the best way to go is by installing it via composer like this: composer require laravelcollective/html "5.5.*".
Here, you just specify the version of the Laravel you've installed. Otherwise, composer will not be able to install it.
After that, you just update the config/app.php file like so:
Add the following line to the $provider array:
Collective\Html\HtmlServiceProvider::class
Then find the aliases array and add these two aliases to the aliases array:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
That is it!
Go to this link:
https://github.com/LaravelCollective/html
download the package and extract it to /vendor/ folder so that you have this path
/vendor/laravelcollective/html/src/HtmlServiceProvider.php
Next, add your new provider to the providers array of config/app.php:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
Finally, add two class aliases to the aliases array of config/app.php:
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
And it should work.

Laravel 5.1 PHPexcel install error

I want to add class PHPExcel to my project. I use composer to add PHPExcel. I tried some command line.
php composer.phar update
or
php composer.phar require phpexcel/phpexcel
But, i alway receive error look like image:
at here. And maatwebsite/excel, too.
What is wrong with my project? Please help me!
First open the file composer.json
and find require object/array and add line
"require": {
"maatwebsite/excel": "~2.1.0"
},
and composer update so composer update is completed
and open the file config/app.php
and find providers object/array and add line
'providers' => [
/*
* Application Service Providers...
*/
'Maatwebsite\Excel\ExcelServiceProvider'
],
and find aliases object/array and add line
'aliases' => [
'Excel' => Maatwebsite\Excel\Facades\Excel::class
]
Remove this line:
"jrenton/laravel-scaffold": "dev-master"
and run composer update again.
jrenton/laravel-scaffold needs "fzaninotto/faker": "1.3.0", which I guess, was used in lower versions of Laravel

Resources