From 8800edc47562c956cf61835fa17c769597ca0893 Mon Sep 17 00:00:00 2001 From: Fabian de Laender Date: Wed, 18 May 2016 16:29:52 +0200 Subject: [PATCH] Version 1.1.2 - Laravel Socialite is now really optional --- composer.json | 8 +++++--- src/MollieServiceProvider.php | 14 ++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 5d03f33..425e93b 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mollie/laravel-mollie", "description": "Mollie API client wrapper for Laravel & Mollie Connect provider for Laravel Socialite", - "version": "1.1.1", + "version": "1.1.2", "homepage": "https://github.com/mollie/laravel-mollie", "license": "BSD-2-Clause", "authors": [ @@ -18,8 +18,10 @@ "require": { "illuminate/contracts": "5.0.*|5.1.*|5.2.*", "illuminate/support": "5.0.*|5.1.*|5.2.*", - "mollie/mollie-api-php": "~1.0", - "laravel/socialite": "~2.0" + "mollie/mollie-api-php": "~1.0" + }, + "suggest": { + "laravel/socialite": "Use Mollie Connect (OAuth) to authenticate via Laravel Socialite with the Mollie API. This is needed for some endpoints." }, "autoload": { "psr-4": { diff --git a/src/MollieServiceProvider.php b/src/MollieServiceProvider.php index 5d42520..6b81f7f 100644 --- a/src/MollieServiceProvider.php +++ b/src/MollieServiceProvider.php @@ -69,17 +69,19 @@ protected function setupConfig() } /** - * Extend the Laravel Socialite factory class. + * Extend the Laravel Socialite factory class, if available. */ protected function extendSocialite() { - $socialite = $this->app->make('Laravel\Socialite\Contracts\Factory'); + if (class_exists('Laravel\Socialite\Contracts\Factory')) { + $socialite = $this->app->make('Laravel\Socialite\Contracts\Factory'); - $socialite->extend('mollie', function (Container $app) use ($socialite) { - $config = $app['config']['services.mollie']; + $socialite->extend('mollie', function (Container $app) use ($socialite) { + $config = $app['config']['services.mollie']; - return $socialite->buildProvider(MollieConnectProvider::class, $config); - }); + return $socialite->buildProvider(MollieConnectProvider::class, $config); + }); + } } /**