Skip to content

Commit

Permalink
Bump SDK and use Guzzle as default HTTP Client (#30)
Browse files Browse the repository at this point in the history
Note: ignoring style CI for the time being as this will be updated to use Laravel Pint and PER codeing standards in the future
  • Loading branch information
joelbutcher authored Jan 31, 2025
1 parent d40676a commit fb7e312
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"require": {
"php": "^7.3|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"joelbutcher/facebook-graph-sdk": "^6.0.0",
"symfony/http-client": "^5.3|^6.0|^7.0"
"joelbutcher/facebook-graph-sdk": "^6.1.2"
},
"require-dev": {
"mockery/mockery": "^1.4.2",
Expand Down
9 changes: 5 additions & 4 deletions src/FacebookServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
use Facebook\PersistentData\PersistentDataInterface;
use Facebook\Url\UrlDetectionHandler;
use Facebook\Url\UrlDetectionInterface;
use Http\Client\HttpClient;
use GuzzleHttp\Client;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use Psr\Http\Client\ClientInterface;

class FacebookServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -76,8 +77,8 @@ protected function getConfigPath(): string
*/
protected function registerDefaultHttpClient(): void
{
$this->app->singleton(HttpClient::class, function () {
return null;
$this->app->singleton(ClientInterface::class, function () {
return new Client();
});
}

Expand Down Expand Up @@ -125,7 +126,7 @@ protected function registerFacebook(): void
'default_graph_version' => $app['config']->get('facebook.graph_version'),
'enable_beta_mode' => $app['config']->get('facebook.beta_mode'),
'persistent_data_handler' => $app[PersistentDataInterface::class],
'http_client' => $app[HttpClient::class],
'http_client' => $app[ClientInterface::class],
'url_detection_handler' => $app[UrlDetectionInterface::class],
]);
});
Expand Down
2 changes: 2 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use JoelButcher\Facebook\Facebook;
use JoelButcher\Facebook\FacebookServiceProvider;
use Psr\Http\Client\ClientInterface;

abstract class TestCase extends \Orchestra\Testbench\TestCase
{
Expand All @@ -23,6 +24,7 @@ protected function setUp(): void
'app_secret' => $this->app['config']->get('facebook.app_secret'),
'redirect_uri' => $this->app['config']->get('facebook.redirect_uri'),
'default_graph_version' => $this->app['config']->get('facebook.graph_version'),
'http_client' => $this->app[ClientInterface::class]
];
}

Expand Down

0 comments on commit fb7e312

Please sign in to comment.