update composer.json

This commit is contained in:
Khoubza Younes
2020-12-06 16:34:11 +01:00
parent 9fbbfa6588
commit bffd95429f
7 changed files with 42 additions and 42 deletions
@@ -6,7 +6,7 @@ use Illuminate\Contracts\Support\DeferrableProvider;
use Illuminate\Support\ServiceProvider;
use Flasher\Toastr\Laravel\ServiceProvider\ServiceProviderManager;
class NotifyToastrServiceProvider extends ServiceProvider
class FlasherToastrServiceProvider extends ServiceProvider
{
public function boot()
{
+17 -17
View File
@@ -4,9 +4,9 @@ namespace Flasher\Toastr\Laravel\ServiceProvider\Providers;
use Flasher\Prime\Flasher;
use Flasher\Prime\Renderer\RendererManager;
use Flasher\Toastr\LaravelFlasher\PrimeToastrServiceProvider;
use Flasher\Toastr\Prime\Factory\ToastrProducer;
use Flasher\Toastr\Prime\Renderer\ToastrRenderer;
use Flasher\Toastr\Laravel\FlasherToastrServiceProvider;
use Flasher\Toastr\Prime\ToastrFactory;
use Flasher\Toastr\Prime\ToastrRenderer;
use Illuminate\Container\Container;
use Illuminate\Foundation\Application;
@@ -24,36 +24,36 @@ class Laravel implements ServiceProviderInterface
return $this->app instanceof Application;
}
public function publishConfig(NotifyToastrServiceProvider $provider)
public function publishConfig(FlasherToastrServiceProvider $provider)
{
$source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw;
$provider->publishes(array($source => config_path('notify_toastr.php')), 'config');
$provider->publishes(array($source => config_path('flasher_toastr.php')), 'config');
$provider->mergeConfigFrom($source, 'notify_toastr');
$provider->mergeConfigFrom($source, 'flasher_toastr');
}
public function registerNotifyToastrServices()
public function registerToastrServices()
{
$this->app->singleton('flasher.factory.toastr', function (Container $app) {
return new ToastrProducer($app['flasher.storage'], $app['flasher.middleware']);
return new ToastrFactory($app['flasher.event_dispatcher']);
});
$this->app->singleton('flasher.renderer.toastr', function (Container $app) {
return new ToastrRenderer($app['flasher.config']);
});
$this->app->alias('flasher.factory.toastr', 'Flasher\Toastr\Prime\Factory\ToastrProducer');
$this->app->alias('flasher.renderer.toastr', 'Flasher\Toastr\Prime\Renderer\ToastrRenderer');
$this->app->alias('flasher.factory.toastr', 'Flasher\Toastr\Prime\ToastrFactory');
$this->app->alias('flasher.renderer.toastr', 'Flasher\Toastr\Prime\ToastrRenderer');
$this->app->extend('flasher.factory', function (Flasher $manager, Container $app) {
$manager->addDriver('toastr', $app['flasher.factory.toastr']);
$this->app->extend('flasher.factory', function (Flasher $flasher, Container $app) {
$flasher->addDriver($app['flasher.factory.toastr']);
return $manager;
return $flasher;
});
$this->app->extend('flasher.renderer', function (RendererManager $manager, Container $app) {
$manager->addDriver('toastr', $app['flasher.renderer.toastr']);
$manager->addDriver($app['flasher.renderer.toastr']);
return $manager;
});
@@ -61,10 +61,10 @@ class Laravel implements ServiceProviderInterface
public function mergeConfigFromToastr()
{
$notifyConfig = $this->app['config']->get('flasher.adapters.toastr', array());
$flasherConfig = $this->app['config']->get('flasher.adapters.toastr', array());
$toastrConfig = $this->app['config']->get('notify_toastr', array());
$toastrConfig = $this->app['config']->get('flasher_toastr', array());
$this->app['config']->set('flasher.adapters.toastr', array_merge($toastrConfig, $notifyConfig));
$this->app['config']->set('flasher.adapters.toastr', array_merge($toastrConfig, $flasherConfig));
}
}
+6 -6
View File
@@ -2,8 +2,8 @@
namespace Flasher\Toastr\Laravel\ServiceProvider\Providers;
use Flasher\Toastr\Laravel\FlasherToastrServiceProvider;
use Illuminate\Foundation\Application;
use Flasher\Toastr\LaravelFlasher\PrimeToastrServiceProvider;
final class Laravel4 extends Laravel
{
@@ -12,17 +12,17 @@ final class Laravel4 extends Laravel
return $this->app instanceof Application && 0 === strpos(Application::VERSION, '4.');
}
public function publishConfig(NotifyToastrServiceProvider $provider)
public function publishConfig(FlasherToastrServiceProvider $provider)
{
$provider->package('php-flasher/flasher-laravel-toastr', 'notify_toastr', __DIR__.'/../../../resources');
$provider->package('php-flasher/flasher-laravel-toastr', 'flasher_toastr', __DIR__.'/../../../resources');
}
public function mergeConfigFromToastr()
{
$notifyConfig = $this->app['config']->get('notify::config.adapters.toastr', array());
$flasherConfig = $this->app['config']->get('flasher::config.adapters.toastr', array());
$toastrConfig = $this->app['config']->get('notify_toastr::config', array());
$toastrConfig = $this->app['config']->get('flasher_toastr::config', array());
$this->app['config']->set('notify::config.adapters.toastr', array_merge($toastrConfig, $notifyConfig));
$this->app['config']->set('flasher::config.adapters.toastr', array_merge($toastrConfig, $flasherConfig));
}
}
+4 -4
View File
@@ -2,8 +2,8 @@
namespace Flasher\Toastr\Laravel\ServiceProvider\Providers;
use Flasher\Toastr\Laravel\FlasherToastrServiceProvider;
use Laravel\Lumen\Application;
use Flasher\Toastr\LaravelFlasher\PrimeToastrServiceProvider;
final class Lumen extends Laravel
{
@@ -12,12 +12,12 @@ final class Lumen extends Laravel
return $this->app instanceof Application;
}
public function publishConfig(NotifyToastrServiceProvider $provider)
public function publishConfig(FlasherToastrServiceProvider $provider)
{
$source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw;
$this->app->configure('notify_toastr');
$this->app->configure('flasher_toastr');
$provider->mergeConfigFrom($source, 'notify_toastr');
$provider->mergeConfigFrom($source, 'flasher_toastr');
}
}
@@ -2,15 +2,15 @@
namespace Flasher\Toastr\Laravel\ServiceProvider\Providers;
use Flasher\Toastr\LaravelFlasher\PrimeToastrServiceProvider;
use Flasher\Toastr\Laravel\FlasherToastrServiceProvider;
interface ServiceProviderInterface
{
public function shouldBeUsed();
public function publishConfig(NotifyToastrServiceProvider $provider);
public function publishConfig(FlasherToastrServiceProvider $provider);
public function registerNotifyToastrServices();
public function registerToastrServices();
public function mergeConfigFromToastr();
}
+3 -3
View File
@@ -2,7 +2,7 @@
namespace Flasher\Toastr\Laravel\ServiceProvider;
use Flasher\Toastr\LaravelFlasher\PrimeToastrServiceProvider;
use Flasher\Toastr\Laravel\FlasherToastrServiceProvider;
use Flasher\Toastr\Laravel\ServiceProvider\Providers\ServiceProviderInterface;
final class ServiceProviderManager
@@ -20,7 +20,7 @@ final class ServiceProviderManager
private $notifyServiceProvider;
public function __construct(NotifyToastrServiceProvider $notifyServiceProvider)
public function __construct(FlasherToastrServiceProvider $notifyServiceProvider)
{
$this->notifyServiceProvider = $notifyServiceProvider;
}
@@ -36,7 +36,7 @@ final class ServiceProviderManager
public function register()
{
$provider = $this->resolveServiceProvider();
$provider->registerNotifyToastrServices();
$provider->registerToastrServices();
}
/**
+8 -8
View File
@@ -1,5 +1,5 @@
{
"name": "php-flasher/flasher-laravel-toastr",
"name": "php-flasher/flasher-toastr-laravel",
"description": "Laravel Flasher adapter package for php-flasher/flasher-toastr",
"keywords": [
"yoeunes",
@@ -28,27 +28,27 @@
"license": "MIT",
"require": {
"php": ">=5.3",
"php-flasher/flasher-laravel": "^1.0.4",
"php-flasher/flasher-toastr": "^1.0"
"php-flasher/flasher-laravel": "dev-main",
"php-flasher/flasher-toastr": "dev-main"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.7 || ^6.0 || ^7.0 || ^8.3 || ^9.0",
"orchestra/testbench": "^2.0 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
"phpunit/phpunit": "^4.8|^5.7|^6.0|^7.0|^8.3|^9.0",
"orchestra/testbench": "^2.0|^3.0|^4.0|^5.0|^6.0"
},
"autoload": {
"psr-4": {
"Flasher\\Laravel\\Toastr\\": "src/"
"Flasher\\Toastr\\Laravel\\": ""
}
},
"autoload-dev": {
"psr-4": {
"Flasher\\Laravel\\Toastr\\Tests\\": "tests/"
"Flasher\\Toastr\\Laravel\\Tests\\": "Tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Flasher\\Laravel\\Toastr\Flasher\PrimeToastrServiceProvider"
"Flasher\\Toastr\\Laravel\\FlasherToastrServiceProvider"
]
}
},