commit d09b15c7e4a536f3c339a4053e0f3ecf5e075d18 Author: KHOUBZA Younes Date: Wed Dec 2 00:54:31 2020 +0100 add php-notify classes and rename namespaces diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..3383d44b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ + +# Path-based git attributes +# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html + +# Ignore all test and documentation with "export-ignore". +/.gitattributes export-ignore +/.gitignore export-ignore +/.travis.yml export-ignore +/phpunit.xml.dist export-ignore +/.scrutinizer.yml export-ignore +/.styleci.yml export-ignore +/tests export-ignore +/.editorconfig export-ignore diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 00000000..bff1cbe5 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,119 @@ +name: Running tests + +on: + push: + pull_request: + schedule: + - cron: '0 * * * *' + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + laravel: [8.*, 7.*, 6.*, 5.8.*, 5.7.*, 5.6.*, 5.5.*, 5.4.*, 5.3.*, 5.2.*, 5.1.*, 5.0.*, 4.2.*, 4.1.*, 4.0.*] + dependency-version: [prefer-lowest, prefer-stable] + include: + - laravel: 8.* + testbench: 6.* + php: 7.3 + phpunit: 9.3.* + + - laravel: 7.* + testbench: 5.* + php: 7.3 + phpunit: 8.4.* + + - laravel: 6.* + testbench: 4.* + php: 7.2 + phpunit: 8.3.* + + - laravel: 5.8.* + testbench: 3.8.* + php: 7.1 + phpunit: 7.5.* + + - laravel: 5.7.* + testbench: 3.7.* + php: 7.1 + phpunit: 7.0.* + + - laravel: 5.6.* + testbench: 3.6.* + php: 7.1 + phpunit: 7.0.* + + - laravel: 5.5.* + testbench: 3.5.* + php: 7.0 + phpunit: 6.0.* + + - laravel: 5.4.* + testbench: 3.4.* + php: 5.6 + phpunit: 5.7.* + + - laravel: 5.3.* + testbench: 3.3.* + php: 5.6 + phpunit: 4.8.* + + - laravel: 5.2.* + testbench: 3.2.* + php: 5.5 + phpunit: 4.8.* + + - laravel: 5.1.* + testbench: 3.1.* + php: 5.5 + phpunit: 4.8.* + + - laravel: 5.0.* + testbench: 3.0.* + php: 5.4 + phpunit: 4.8.* + + - laravel: 4.2.* + testbench: 2.2.* + php: 5.4 + phpunit: 4.8.* + + - laravel: 4.1.* + testbench: 2.1.* + php: 5.4 + phpunit: 4.8.* + + - laravel: 4.0.* + testbench: 2.0.* + php: 5.4 + phpunit: 4.8.* + + name: L${{ matrix.laravel }} - P${{ matrix.php }} - ${{ matrix.dependency-version }} + + steps: + - name: Checkout code + uses: actions/checkout@v1 + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.composer/cache/files + key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick +# ini-values: memory_limit=-1 + coverage: none + + - name: Install dependencies + run: | + COMPOSER_MEMORY_LIMIT=-1 composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" "orchestra/testbench:${{ matrix.testbench }}" monolog/monolog --no-interaction --no-update + COMPOSER_MEMORY_LIMIT=-1 composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + + - name: Execute tests + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..409f0e32 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea/ +vendor/ +composer.lock +.phpunit.result.cache +.phpcs-cache diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist new file mode 100644 index 00000000..93d245bc --- /dev/null +++ b/.phpcs.xml.dist @@ -0,0 +1,625 @@ + + + + + + + + + + + + + src + tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + error + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Variable "%s" not allowed in double quoted string; use sprintf() or concatenation instead + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php new file mode 100644 index 00000000..aa712a5c --- /dev/null +++ b/.phpstorm.meta.php @@ -0,0 +1,14 @@ + '@'])); +override(RendererManager::make(''), map(['' => '@'])); +override(PresenterManager::make(''), map(['' => '@'])); diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..e69de29b diff --git a/Config/Config.php b/Config/Config.php new file mode 100644 index 00000000..f2e391bc --- /dev/null +++ b/Config/Config.php @@ -0,0 +1,24 @@ +config = $config; + $this->separator = $separator; + } + + public function get($key, $default = null) + { + return $this->config->get('notify'.$this->separator.$key, $default); + } +} diff --git a/NotifyServiceProvider.php b/NotifyServiceProvider.php new file mode 100644 index 00000000..c929acb3 --- /dev/null +++ b/NotifyServiceProvider.php @@ -0,0 +1,63 @@ +boot(); + } + + /** + * Register the service provider. + */ + public function register() + { + $manager = new ServiceProviderManager($this); + $manager->register(); + } + + /** + * Get the services provided by the provider. + * + * @return string[] + */ + public function provides() + { + return array( + 'notify.producer', + ); + } + + /** + * @return \Illuminate\Container\Container + */ + public function getApplication() + { + return $this->app; + } + + /** + * {@inheritdoc} + */ + public function mergeConfigFrom($path, $key) + { + parent::mergeConfigFrom($path, $key); + } + + /** + * {@inheritdoc} + */ + public function publishes(array $paths, $groups = null) + { + parent::publishes($paths, $groups); + } +} diff --git a/README.md b/README.md new file mode 100644 index 00000000..fac4b13f --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +

notify

+ +

Easy flash notifications for PHP, Laravel, Symfony, Lumen

+ +

:eyes: PHP Flasher library helps you to add flash notifications to your projects. This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code. No application-wide rewrites and no big investments upfront.

+ +

+ + + + + + + + + + + + + + + +

+ +## Introduction + +PHP Flasher library helps you to add flash notifications to your projects. This library was developed with the idea that you should be able to add flash notification to your application with ease and with few lines of code. No application-wide rewrites and no big investments upfront. + +# Why use PHP Flasher ? + +The PHP Flasher project supports a variety of notification libraries : __toastr.js__, __sweet alert 2__, __pnotify__ and __notyf__ +and its highly extendable so you can add custom adapters. + +This library is designed, so you can take full control when creating you notifications : + +> * Display multiple notifications +> * Sort and filter notifications +> * Render notification from JSON response with Ajax or Websockets +> * Limit the number of displayed notifications +> * Show notifications from different adapters at the same time +> * implementations for popular frameworks : Symfony and Laravel +> * ...and more + + +## Official Documentation + +Documentation for Valet can be found on the [PHP Flasher website](https://php-flasher.github.io/). + +## License + +PHP Flasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). diff --git a/Resources/config/config.php b/Resources/config/config.php new file mode 100644 index 00000000..9e46f6d2 --- /dev/null +++ b/Resources/config/config.php @@ -0,0 +1,21 @@ + 'toastr', + + 'scripts' => array( + '/vendor/php-flasher/flasher/assets/js/notify.js' + ), + + 'styles' => array( + + ), + + 'adapters' => array( + + ), + + 'stamps_middlewares' => array( + + ), +); diff --git a/Resources/public/notify.js b/Resources/public/notify.js new file mode 100644 index 00000000..0e78e7b5 --- /dev/null +++ b/Resources/public/notify.js @@ -0,0 +1,114 @@ +/*! + * PHPNotify js 1.0.0 + * https://github.com/php-flasher/flasher + * @license MIT licensed + * + * Copyright (C) 2020 Younes KHOUBZA + */ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define([], factory(root)); + } else if (typeof exports === 'object') { + module.exports = factory(root); + } else { + root.PHPNotify = factory(root); + } +})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, function (window) { + + 'use strict'; + + var exports = {}; + + exports.render = function (_settings) { + var settings = Object.assign({}, { + scripts: [], + styles: [], + options: [], + notifications: [], + }, _settings); + + exports.addStyles(settings.styles, function () { + exports.addScripts(settings.scripts, function () { + var script = ''; + + settings.options.forEach(function (option) { + script += option + "\n"; + }); + + script += "\n\n"; + + settings.notifications.forEach(function (notification) { + script += notification.code + "\n"; + }); + + exports.parseScript(script); + }); + }); + }; + + exports.addStyles = function (urls, callback) { + if (0 === urls.length) { + if ("function" === typeof callback) { + callback(); + } + + return this; + } + + if (null !== document.querySelector(`link[href='${urls[0]}']`)) { + return exports.addStyles(urls.slice(1), callback); + } + + var tag = document.createElement('link'); + + tag.href = urls[0]; + tag.type = 'text/css'; + tag.rel = 'stylesheet'; + tag.onload = function () { + exports.addStyles(urls.slice(1), callback); + }; + + document.head.appendChild(tag); + + return this; + }; + + exports.addScripts = function (urls, callback) { + if (0 === urls.length) { + if ("function" === typeof callback) { + callback(); + } + + return this; + } + + if (null !== document.querySelector(`script[src='${urls[0]}']`)) { + return exports.addScripts(urls.slice(1), callback); + } + + var tag = document.createElement('script'); + + tag.src = urls[0]; + tag.type = 'text/javascript'; + tag.onload = function () { + exports.addScripts(urls.slice(1), callback); + }; + + document.body.appendChild(tag); + + return this; + }; + + exports.parseScript = function (script) { + var tag = document.createElement('script'); + + tag.type = "text/javascript"; + tag.text = script; + + document.body.appendChild(tag); + + return this; + }; + + return exports; +}); diff --git a/ServiceProvider/Providers/Laravel.php b/ServiceProvider/Providers/Laravel.php new file mode 100644 index 00000000..400db568 --- /dev/null +++ b/ServiceProvider/Providers/Laravel.php @@ -0,0 +1,136 @@ +app = $app; + } + + public function shouldBeUsed() + { + return $this->app instanceof Application; + } + + public function publishConfig(NotifyServiceProvider $provider) + { + $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; + + $provider->publishes(array($source => config_path('notify.php')), 'config'); + + $provider->mergeConfigFrom($source, 'notify'); + } + + public function publishAssets(NotifyServiceProvider $provider) + { + $provider->publishes(array(__DIR__.'/../../../public' => public_path('vendor/php-flasher/flasher/assets/js')), 'public'); + } + + public function registerNotifyServices() + { + $this->app->singleton('notify.config', function (Application $app) { + return new Config($app['config'], '.'); + }); + + $this->registerCommonServices(); + } + + public function registerCommonServices() + { + $this->app->singleton('notify.producer', function (Application $app) { + return new Flasher($app['notify.config']); + }); + + $this->app->singleton('notify.storage', function (Application $app) { + return new Storage($app['session']); + }); + + $this->app->singleton('notify.filter', function (Application $app) { + return new FilterManager($app['notify.config']); + }); + + $this->app->singleton('notify.renderer', function (Application $app) { + return new RendererManager($app['notify.config']); + }); + + $this->app->singleton('notify.presenter', function (Application $app) { + return new PresenterManager(); + }); + + $this->app->singleton('notify.presenter.html', function (Application $app) { + return new HtmlPresenter($app['notify.config'], $app['notify.storage'], $app['notify.filter'], $app['notify.renderer']); + }); + + $this->app->singleton('notify.presenter.json', function (Application $app) { + return new JsonPresenter($app['notify.config'], $app['notify.storage'], $app['notify.filter'], $app['notify.renderer']); + }); + + $this->app->singleton('notify.filter_builder', function (Application $app) { + return new FilterBuilder(); + }); + + $this->app->singleton('notify.filter.default', function (Application $app) { + return new DefaultFilter($app['notify.filter_builder']); + }); + + $this->app->singleton('notify.middleware', function (Application $app) { + return new MiddlewareManager($app['notify.config']); + }); + + $this->app->extend('notify.presenter', function (PresenterManager $manager, Container $app) { + $manager->addDriver('html', $app['notify.presenter.html']); + + return $manager; + }); + + $this->app->extend('notify.presenter', function (PresenterManager $manager, Container $app) { + $manager->addDriver('json', $app['notify.presenter.json']); + + return $manager; + }); + + $this->app->extend('notify.filter', function (FilterManager $manager, Container $app) { + $manager->addDriver('default', $app['notify.filter.default']); + + return $manager; + }); + + $this->app->alias('notify.config', 'Flasher\Laravel\Config\Config'); + $this->app->alias('notify.producer', 'Flasher\Prime\Flasher'); + $this->app->alias('notify.presenter', 'Flasher\Prime\Presenter\PresenterManager'); + $this->app->alias('notify.middleware', 'Flasher\Prime\Middleware\MiddlewareManager'); + $this->app->alias('notify.storage', 'Flasher\Laravel\Storage\Storage'); + $this->app->alias('notify.filter', 'Flasher\Prime\Filter\FilterManager'); + $this->app->alias('notify.presenter.html', 'Flasher\Prime\Presenter\Adapter\HtmlPresenter'); + $this->app->alias('notify.presenter.json', 'Flasher\Prime\Presenter\Adapter\JsonPresenter'); + $this->app->alias('notify.filter_builder', 'Flasher\Prime\Filter\FilterBuilder'); + $this->app->alias('notify.filter.default', 'Flasher\Prime\Filter\DefaultFilter'); + } + + public function registerBladeDirectives() + { + Blade::directive('notify_render', function ($criteria = null) { + return "render($criteria); ?>"; + }); + } +} diff --git a/ServiceProvider/Providers/Laravel4.php b/ServiceProvider/Providers/Laravel4.php new file mode 100644 index 00000000..170c6575 --- /dev/null +++ b/ServiceProvider/Providers/Laravel4.php @@ -0,0 +1,44 @@ +app instanceof Application && 0 === strpos(Application::VERSION, '4.'); + } + + public function publishConfig(NotifyServiceProvider $provider) + { + $provider->package('php-flasher/flasher-laravel', 'notify', __DIR__.'/../../../resources'); + } + + public function publishAssets(NotifyServiceProvider $provider) + { + } + + public function registerNotifyServices() + { + $this->app->singleton('notify.config', function (Application $app) { + return new Config($app['config'], '::'); + }); + + $this->registerCommonServices(); + } + + public function registerBladeDirectives() + { + Blade::extend(function ($view, $compiler) { + $pattern = $compiler->createPlainMatcher('notify_render(.*)'); + + return preg_replace($pattern, '$1render($2); ?>', $view); + }); + } +} diff --git a/ServiceProvider/Providers/Laravel50.php b/ServiceProvider/Providers/Laravel50.php new file mode 100644 index 00000000..3f0b8702 --- /dev/null +++ b/ServiceProvider/Providers/Laravel50.php @@ -0,0 +1,23 @@ +app instanceof Application && 0 === strpos(Application::VERSION, '5.0'); + } + + public function registerBladeDirectives() + { + Blade::extend(function ($view, $compiler) { + $pattern = $compiler->createPlainMatcher('notify_render(.*)'); + + return preg_replace($pattern, '$1render($2); ?>', $view); + }); + } +} diff --git a/ServiceProvider/Providers/Lumen.php b/ServiceProvider/Providers/Lumen.php new file mode 100644 index 00000000..b1c4ebf5 --- /dev/null +++ b/ServiceProvider/Providers/Lumen.php @@ -0,0 +1,31 @@ +app instanceof Application; + } + + public function publishConfig(NotifyServiceProvider $provider) + { + $source = realpath($raw = __DIR__.'/../../../resources/config/config.php') ?: $raw; + + $this->app->configure('notify'); + + $provider->mergeConfigFrom($source, 'notify'); + } + + public function registerNotifyServices() + { + $this->app->register('\Illuminate\Session\SessionServiceProvider'); + $this->app->configure('session'); + + parent::registerNotifyServices(); + } +} diff --git a/ServiceProvider/Providers/ServiceProviderInterface.php b/ServiceProvider/Providers/ServiceProviderInterface.php new file mode 100644 index 00000000..7947cdc5 --- /dev/null +++ b/ServiceProvider/Providers/ServiceProviderInterface.php @@ -0,0 +1,18 @@ +notifyServiceProvider = $notifyServiceProvider; + } + + public function boot() + { + $provider = $this->resolveServiceProvider(); + + $provider->publishConfig($this->notifyServiceProvider); + $provider->publishAssets($this->notifyServiceProvider); + $provider->registerBladeDirectives(); + } + + public function register() + { + $provider = $this->resolveServiceProvider(); + $provider->registerNotifyServices(); + } + + /** + * @return ServiceProviderInterface + */ + private function resolveServiceProvider() + { + if ($this->provider instanceof ServiceProviderInterface) { + return $this->provider; + } + + foreach ($this->providers as $providerClass) { + $provider = new $providerClass($this->notifyServiceProvider->getApplication()); + + if ($provider->shouldBeUsed()) { + return $this->provider = $provider; + } + } + + throw new \InvalidArgumentException('Service Provider not found.'); + } +} diff --git a/Storage/Storage.php b/Storage/Storage.php new file mode 100644 index 00000000..c4a493be --- /dev/null +++ b/Storage/Storage.php @@ -0,0 +1,85 @@ +session = $session; + } + + public function get() + { + return $this->session->get(self::ENVELOPES_NAMESPACE, array()); + } + + public function add(Envelope $envelope) + { + if (null === $envelope->get('Flasher\Prime\Stamp\UuidStamp')) { + $envelope->withStamp(new UuidStamp()); + } + + if (null === $envelope->get('Flasher\Prime\Stamp\LifeStamp')) { + $envelope->withStamp(new LifeStamp(1)); + } + + if (null === $envelope->get('Flasher\Prime\Stamp\CreatedAtStamp')) { + $envelope->withStamp(new CreatedAtStamp()); + } + + + $envelopes = $this->get(); + $envelopes[] = $envelope; + + $this->session->put(self::ENVELOPES_NAMESPACE, $envelopes); + } + + /** + * @param \Flasher\Prime\Envelope[] $envelopes + */ + public function flush($envelopes) + { + $envelopesMap = array(); + + foreach ($envelopes as $envelope) { + $life = $envelope->get('Flasher\Prime\Stamp\LifeStamp')->getLife(); + $uuid = $envelope->get('Flasher\Prime\Stamp\UuidStamp')->getUuid(); + + $envelopesMap[$uuid] = $life; + } + + $store = array(); + + foreach ($this->session->get(self::ENVELOPES_NAMESPACE, array()) as $envelope) { + $uuid = $envelope->get('Flasher\Prime\Stamp\UuidStamp')->getUuid(); + + if(isset($envelopesMap[$uuid])) { + $life = $envelopesMap[$uuid] - 1; + + if ($life <= 0) { + continue; + } + + $envelope->with(new LifeStamp($life)); + } + + $store[] = $envelope; + } + + $this->session->put(self::ENVELOPES_NAMESPACE, $store); + } +} diff --git a/Tests/Config/ConfigTest.php b/Tests/Config/ConfigTest.php new file mode 100644 index 00000000..4fc07f55 --- /dev/null +++ b/Tests/Config/ConfigTest.php @@ -0,0 +1,24 @@ +isLaravel4() ? '::' : '.'; + $config = new Config($this->app->make('config'), $separator); + + $this->assertEquals('toastr', $config->get('default')); + $this->assertSame(array(), $config->get('adapters', array())); + } + + private function isLaravel4() + { + return 0 === strpos(Application::VERSION, '4.'); + } +} diff --git a/Tests/NotifyServiceProviderTest.php b/Tests/NotifyServiceProviderTest.php new file mode 100644 index 00000000..14b431a5 --- /dev/null +++ b/Tests/NotifyServiceProviderTest.php @@ -0,0 +1,32 @@ +assertTrue($this->app->bound('notify.producer')); + } + + public function test_notify_manager_get_config() + { + $notify = $this->app->make('notify.producer'); + + $reflection = new \ReflectionClass(get_class($notify)); + $config = $reflection->getProperty('config'); + $config->setAccessible(true); + + $this->assertInstanceOf('Flasher\Prime\Config\ConfigInterface', $config->getValue($notify)); + } + + public function test_blade_directive() + { + /** @var BladeCompiler $blade */ + $blade = $this->app->make('view')->getEngineResolver()->resolve('blade')->getCompiler(); + + $this->assertEquals("render(); ?>", $blade->compileString('@notify_render')); + } +} diff --git a/Tests/Storage/StorageTest.php b/Tests/Storage/StorageTest.php new file mode 100644 index 00000000..845506ec --- /dev/null +++ b/Tests/Storage/StorageTest.php @@ -0,0 +1,21 @@ +app->make('session')); + + $envelope = new Envelope(new Notification('success', 'message')); + $session->add($envelope); + + $this->assertEquals(array($envelope), $session->get()); + } +} diff --git a/Tests/TestCase.php b/Tests/TestCase.php new file mode 100644 index 00000000..9dc48bc5 --- /dev/null +++ b/Tests/TestCase.php @@ -0,0 +1,28 @@ +set('session.driver', 'array'); + } +} diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 00000000..e69de29b diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..ee6852c8 --- /dev/null +++ b/composer.json @@ -0,0 +1,66 @@ +{ + "name": "php-flasher/flasher-laravel", + "description": "Laravel Flasher package for php-flasher/flasher", + "keywords": [ + "yoeunes", + "notify", + "php", + "laravel", + "symfony", + "Lumen", + "notifications", + "messages", + "alerts", + "pnotify", + "toastr ", + "bundle", + "flex" + ], + "homepage": "https://github.com/php-flasher/flasher-laravel", + "authors": [ + { + "name": "Younes Khoubza", + "email": "younes.khoubza@gmail.com", + "homepage": "https://github.com/yoeunes", + "role": "Developer" + } + ], + "license": "MIT", + "require": { + "php": ">=5.3", + "illuminate/support": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0", + "php-flasher/flasher": "^1.0" + }, + "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" + }, + "autoload": { + "psr-4": { + "Flasher\\Laravel\\": "src/" + }, + "files": [ + "helpers.php" + ] + }, + "autoload-dev": { + "psr-4": { + "Flasher\\Laravel\\Tests\\": "tests/" + } + }, + "extra": { + "laravel": { + "providers": [ + "Flasher\\Laravel\\NotifyServiceProvider" + ], + "aliases": { + "Flasher": "Flasher\\Laravel\\Facades\\Flasher" + } + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/helpers.php b/helpers.php new file mode 100644 index 00000000..b86eccc9 --- /dev/null +++ b/helpers.php @@ -0,0 +1,21 @@ +render($type, $message, $title, $options, $stamps); + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..2621c486 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,22 @@ + + + + + tests + + + + + src/ + + +