From da53528973b11189481a259d5618d8cc945640fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Chojnicki?= Date: Thu, 23 May 2024 16:38:33 +0200 Subject: [PATCH] Add Lumen framework support --- src/ServiceProvider.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 8462751..011fb4c 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -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. * @@ -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') ); @@ -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. *