Laravel: Class 'SocialiteProviders\Manager\ServiceProvider' not found - laravel

I am getting the following error when I trying to use Socialite with Laravel and extending it with SocialiteProviders. I have tried other solutions but nothing seems to get rid of this error. Does anyone have any suggestions??? Thanks.
ERROR: Class 'SocialiteProviders\Manager\ServiceProvider' not found
File: Composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"arcanedev/log-viewer": "~4.7.0",
"barryvdh/laravel-cors": "^0.11.3",
"beyondcode/laravel-mailbox": "^1.2",
"browner12/helpers": "^2.1",
"chumper/zipper": "^1.0",
"fideloper/proxy": "^4.0",
"intervention/image": "^2.5",
"laravel/framework": "5.8.*",
"laravel/socialite": "^4.3",
"laravel/tinker": "^1.0",
"league/flysystem-sftp": "^1.0",
"phpmailer/phpmailer": "^6.0",
"socialiteproviders/facebook": "^1.0",
"socialiteproviders/generators": "^4.5",
"socialiteproviders/github": "dev-master",
"socialiteproviders/google": "^3.0",
"socialiteproviders/instagram": "^3.0",
"socialiteproviders/linkedin": "^3.1",
"socialiteproviders/manager": "^3.4",
"socialiteproviders/twitter": "^3.0",
"socialiteproviders/vkontakte": "^4.0",
"socialiteproviders/youtube": "^3.0",
"stripe/stripe-php": "^6.40",
"toin0u/geocoder-laravel": "^4.1",
"tymon/jwt-auth": "1.0.*",
"zanysoft/laravel-zip": "^1.0"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5",
"infyomlabs/laravel-generator": "5.8.x-dev",
"laravelcollective/html": "^5.8.0",
"infyomlabs/adminlte-templates": "5.8.x-dev",
"infyomlabs/swagger-generator": "dev-master",
"appointer/swaggervel": "dev-master",
"doctrine/dbal": "~2.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
File app.php
'providers' => [
\SocialiteProviders\Manager\ServiceProvider::class,
],
'aliases' => [
'Socialite' => Illuminate\Socialite\Facades\Socialite::class,
],
File: EventServiceProvider.php
protected $listen = [
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// add your listeners (aka providers) here
'SocialiteProviders\\Facebook\\FacebookExtendSocialite#handle',
'SocialiteProviders\\GitHub\\GitHubExtendSocialite#handle',
'SocialiteProviders\\Google\\GoogleExtendSocialite#handle',
'SocialiteProviders\\Instagram\\InstagramExtendSocialite#handle',
'SocialiteProviders\\LinkedIn\\LinkedInExtendSocialite#handle',
'SocialiteProviders\\PayPal\\PayPalExtendSocialite#handle',
'SocialiteProviders\\Twitter\\TwitterExtendSocialite#handle',
'SocialiteProviders\\VKontakte\\VKontakteExtendSocialite#handle',
'SocialiteProviders\\YouTube\\YouTubeExtendSocialite#handle',
],
Registered::class => [
SendEmailVerificationNotification::class,
],
];
File: AuthController.php
namespace App\Http\Controllers\Web;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Socialite;
class AuthController extends Controller
{
...

Newbie issue.... Composer self "Killed". Fixed the issue by adding swap memory before running composer.
UPDATED to include the command I used to add swap and fix the problem.
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1

Related

Call to undefined method Illuminate\Foundation\Application::share() - LARAVEL 9 EXCEL

i want to make export excel using composer require maatwebsite/excel
this is composer.json code
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"barryvdh/laravel-dompdf": "^2.0",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"laravel/ui": "^4.0",
"maatwebsite/excel": "*"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\": "app/",
"Database\Factories\": "database/factories/",
"Database\Seeders\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-update-cmd": [
"#php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"#php -r "file_exists('.env') || copy('.env.example', '.env');""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
when i write
php artisan vendor:publish –provider=”Maatwebsite\Excel\ExcelServiceProvider” –tag=config
the error appears as follows:
Call to undefined method Illuminate\Foundation\Application::share()
at vendor/maatwebsite/excel/src/Maatwebsite/Excel/ExcelServiceProvider.php:159
155▕ */
156▕ protected function bindClasses()
157▕ {
158▕ // Bind the format identifier
➜ 159▕ $this->app['excel.identifier'] = $this->app->share(function($app) {
160▕ return new FormatIdentifier($app['files']);
161▕ });
162▕ }
163▕
+8 vendor frames
9 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
I have followed these tips, but still confused about the share() method in the comments all or not? Laravel - Call to undefined method Illuminate\Foundation\Application::share()

Cannot update laravel/passport

Actually Im trying to set API for my website on Laravel. I found that I need to add CreateFreshApiToken to Kernel.php in order to use it. Well, I wish could, but it doesn't exist. Then I have found I can get it via
composer require laravel/passport
I run it and have this one
composer require laravel/passport
./composer.json has been updated
Running composer update laravel/passport
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- artogrig/laravel-make-service[1.0.0, ..., 1.0.1] require illuminate/support ~5 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires artogrig/laravel-make-service ^1.0 -> satisfiable by artogrig/laravel-make-service[1.0.0, 1.0.1].
This is my comsposer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"artogrig/laravel-make-service": "^1.0",
"cviebrock/eloquent-sluggable": "^7.0",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"intervention/image": "^2.5",
"laravel/framework": "^7.0",
"laravel/passport": "^4.0",
"laravel/socialite": "^3.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"tcg/voyager": "^1.4"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
},
"repositories": {
"hooks": {
"type": "composer",
"url": "https://larapack.io"
}
}
}
I have no idea what to do with. Could someone help me, please!
Thanks!
The dependency artogrig/laravel-make-service only works with Illuminate\Support 5, for what this package does, create service classes and is unmaintained. I would simply just remove it and your dependencies would be fixed.

Upgrade Laravel project from 5.5 to latest version 8

I want to Upgrade my Laravel project from (5.5 to 8) what I will do for that.
I didn't found any documents to upgrade from 5.5 to 8 just upgrade from 5.5 to 5.6 or from 7 to 8 maybe must upgrade the project step by step from 5.5 to 5.6 the from 5.6 to 5.7 then .... nutil 8
Thanks
composer.json(Laravel 5.5):
{
"name": "HomFolio",
"description": "Smart Property Investing",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.0.0",
"ext-json": "*",
"barryvdh/laravel-dompdf": "^0.8.1",
"barryvdh/laravel-translation-manager": "dev-master",
"fideloper/proxy": "~3.3",
"intervention/image": "^2.4",
"joedixon/laravel-translation": "^1.1",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"stripe/stripe-php": "^4.7",
"zizaco/entrust": "dev-master"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"xethron/migrations-generator": "^2.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
composer.json (Laravel 8):
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0"
},
"require-dev": {
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
Looks like upgrades are sequential. As of today, I have a laravel 5.7 project that I have to upgrade to Laravel 8 and this looks like the sequence I need to take.
Even when you opt for the highly recommended Laravel Shift, you have to pay for each upgrade as indicated in the picture below.
.
If you have budget, laravel shift looks like a quick and easy way to go through the upgrade(s)
You have to follow the steps given below:
Copy the your current composer.json file.
Now go here https://github.com/laravel-shift/laravel-8.x/blob/master/composer.json and copy composer.json file and replace with your existing composer.json file.
Again go to https://github.com/laravel-shift/laravel-8.x/blob/master/app/Exceptions/Handler.php and copy the Handler.php file and go to app/exceptions/Handler.php replace Handler.php with your existing file.
Run the command composer update.
Check your old or your copied composer.json file and if packages have been added to it then you can add packages through this command composer require <package name>.
Now, again run composer update command.
You going to have to upgrade iteratively I'm afraid.
If you have the budget, you can use a service like Laravel Shift
to automate the upgrade.
Adding to some missing steps to #Krina Mangukiya
/bootstrap/environment.php :
$dotenv = Dotenv\Dotenv::createImmutable(DIR.'/..');
$dotenv->load();
The report and render methods of your application's
App\Exceptions\Handler class should accept instances of the Throwable
interface instead of Exception instances:
use Throwable;
public function report(Throwable $exception); public function
render($request, Throwable $exception);
This answers have taken from stackoverflow only but would be go to have all issue answers in one place.

laravel error Illuminate\Routing\RouteFileRegistrar::register(): Failed

Hi I have a problem in laravel version 7
When i run Laravel in localhost, every thing is OK but when i run in Cpanel i get this error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Illuminate\Routing\RouteFileRegistrar::register(): Failed opening required '????/laravelPortal/routes/Api.php' (include_path='.:/opt/cpanel/ea-php72/root/usr/share/pear')
To make sure the files are loaded so i tested other Laravel sample in this location and it was true work also i remove all of routes file but i get Same above Error
Route::group(['prefix' => 'user'], function () {
Route::post('login', 'Api\UserController#login');
Route::post('register', 'Api\UserController#register');
Route::get('getUser/{id}', 'Api\UserController#getUser')->middleware(['auth:api','scopes:admin,user']);
Route::get('getUser', 'Api\UserController#getUser');
Route::get('logout', 'Api\UserController#logout') ->middleware(['auth:api','scope:admin,user']);
Route::get('checkAdmin', 'Api\UserController#checkAdmin')->middleware(['auth:api','scope:admin']);
});
my composer :
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.8.*",
"laravel/passport": "7.5.1",
"laravel/tinker": "^1.0",
"morilog/jalali": "3.*",
"shetabit/payment": "^2.1"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover --ansi"
],
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate --ansi"
]
}
}
i had the same issue with linux,it was a kind of case sensitive issue from my end,
i corrected the filename and file and that solved my issue
You can try this
Route::prefix('user')->group(function () {Your routes here});

Class 'Pusher\Pusher' not found Laravel Lumen

I am testing pusher in my laravel lumen but i get an error with Pusher\Pusher:
I have already tried adding an alias for it and registering it but still no luck:
$app->alias('Pusher', Pusher\Pusher::class);
$app->register(Pusher\Pusher::class);
i have also deleted my vendor folder and reintalled my composer dependencies.
see below for my composer.json
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.2",
"appzcoder/lumen-routes-list": "^1.1",
"dusterio/lumen-passport": "^0.2.15",
"google/cloud-text-to-speech": "^0.5.0",
"guzzlehttp/guzzle": "~5.3|~6.0",
"illuminate/mail": "6.0",
"illuminate/redis": "^6.2",
"laravel/lumen-framework": "^6.0",
"laravelista/lumen-vendor-publish": "6.0",
"league/flysystem": "^1.0",
"predis/predis": "^1.1",
"pusher/pusher-php-server": "~2.0",
"smalot/pdfparser": "^0.14.0",
"superbalist/flysystem-google-storage": "^7.2",
"superbalist/laravel-google-cloud-storage": "^2.2"
},
"require-dev": {
"fzaninotto/faker": "^1.4",
"phpunit/phpunit": "^8.0",
"mockery/mockery": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
You need to upgrade pusher/pusher-php-server sdk package version 3 or later. Pusher PHP sdk use namespace from version 3. To learn more visit their GitHub repo

Resources