Skip to content

Commit

Permalink
Add Lumen framework support
Browse files Browse the repository at this point in the history
  • Loading branch information
chojnicki authored May 23, 2024
1 parent 0a669eb commit da53528
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Chojnicki\VideoPlatformsParser;

use Illuminate\Foundation\Application as LaravelApplication;
use Laravel\Lumen\Application as LumenApplication;

class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
protected $defer = true;


/**
* Register services.
*
Expand All @@ -16,7 +17,10 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
public function register()
{
$this->app->bind(VideoPlatformsParser::class, function ($app) {
if (!$this->app['config']->get('video-platforms-parser')) return $app;
if (! $this->app['config']->get('video-platforms-parser')) {
return $app;
}

return new VideoPlatformsParser(
$this->app['config']->get('video-platforms-parser')
);
Expand All @@ -30,12 +34,15 @@ public function register()
*/
public function boot()
{
$this->publishes([
__DIR__.'/config/video-platforms-parser.php' => config_path('video-platforms-parser.php'),
]);
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/config/video-platforms-parser.php' => config_path('video-platforms-parser.php'),
]);
} elseif ($this->app instanceof LumenApplication) {
$this->app->configure('video-platforms-parser');
}
}


/**
* Get the services provided by the provider.
*
Expand Down

0 comments on commit da53528

Please sign in to comment.