Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump SDK and use Guzzle as default HTTP Client #30

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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