Skip to content

Commit

Permalink
Add FeedIoServiceProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
sentosango committed Jun 26, 2021
1 parent eb32f89 commit 105018f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"extra": {
"laravel": {
"providers": [
"Inboxly\\Receiver\\FeedIoServiceProvider",
"Inboxly\\Receiver\\ReceiverServiceProvider"
]
}
Expand Down
37 changes: 37 additions & 0 deletions src/FeedIoServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Inboxly\Receiver;

use FeedIo\Adapter\Guzzle\Client as ClientAdapter;
use FeedIo\FeedIo;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use Illuminate\Support\ServiceProvider;
use Psr\Log\NullLogger;

class FeedIoServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->app->bind(ClientInterface::class, Client::class);
}

/**
* Bootstrap services.
*
* @return void
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function boot()
{
$guzzle = $this->app->make(ClientInterface::class);
$feedIo = new FeedIo(new ClientAdapter($guzzle), new NullLogger());

$this->app->instance(FeedIo::class, $feedIo);
}
}

0 comments on commit 105018f

Please sign in to comment.