Skip to content

Commit fb7e312

Browse files
authored
Bump SDK and use Guzzle as default HTTP Client (#30)
Note: ignoring style CI for the time being as this will be updated to use Laravel Pint and PER codeing standards in the future
1 parent d40676a commit fb7e312

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"require": {
2424
"php": "^7.3|^8.0",
2525
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
26-
"joelbutcher/facebook-graph-sdk": "^6.0.0",
27-
"symfony/http-client": "^5.3|^6.0|^7.0"
26+
"joelbutcher/facebook-graph-sdk": "^6.1.2"
2827
},
2928
"require-dev": {
3029
"mockery/mockery": "^1.4.2",

src/FacebookServiceProvider.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
use Facebook\PersistentData\PersistentDataInterface;
66
use Facebook\Url\UrlDetectionHandler;
77
use Facebook\Url\UrlDetectionInterface;
8-
use Http\Client\HttpClient;
8+
use GuzzleHttp\Client;
99
use Illuminate\Contracts\Foundation\Application;
1010
use Illuminate\Support\ServiceProvider;
11+
use Psr\Http\Client\ClientInterface;
1112

1213
class FacebookServiceProvider extends ServiceProvider
1314
{
@@ -76,8 +77,8 @@ protected function getConfigPath(): string
7677
*/
7778
protected function registerDefaultHttpClient(): void
7879
{
79-
$this->app->singleton(HttpClient::class, function () {
80-
return null;
80+
$this->app->singleton(ClientInterface::class, function () {
81+
return new Client();
8182
});
8283
}
8384

@@ -125,7 +126,7 @@ protected function registerFacebook(): void
125126
'default_graph_version' => $app['config']->get('facebook.graph_version'),
126127
'enable_beta_mode' => $app['config']->get('facebook.beta_mode'),
127128
'persistent_data_handler' => $app[PersistentDataInterface::class],
128-
'http_client' => $app[HttpClient::class],
129+
'http_client' => $app[ClientInterface::class],
129130
'url_detection_handler' => $app[UrlDetectionInterface::class],
130131
]);
131132
});

tests/TestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use JoelButcher\Facebook\Facebook;
66
use JoelButcher\Facebook\FacebookServiceProvider;
7+
use Psr\Http\Client\ClientInterface;
78

89
abstract class TestCase extends \Orchestra\Testbench\TestCase
910
{
@@ -23,6 +24,7 @@ protected function setUp(): void
2324
'app_secret' => $this->app['config']->get('facebook.app_secret'),
2425
'redirect_uri' => $this->app['config']->get('facebook.redirect_uri'),
2526
'default_graph_version' => $this->app['config']->get('facebook.graph_version'),
27+
'http_client' => $this->app[ClientInterface::class]
2628
];
2729
}
2830

0 commit comments

Comments
 (0)