Compare commits

..

16 Commits

Author SHA1 Message Date
KHOUBZA Younes 9abe8b76ea update workflows test yml 2021-05-06 12:14:54 +00:00
KHOUBZA Younes 4d7d950f6f Merge remote-tracking branch 'toastr-symfony/main' 2021-05-02 14:41:24 +00:00
KHOUBZA Younes ce0a6e70fc rename extensions 2021-04-17 18:40:02 +02:00
KHOUBZA Younes 60a76cf1c3 rename symfony extensions 2021-04-17 18:13:10 +02:00
KHOUBZA Younes 3f0087d7c3 rename symfony bundles names to fix symfony flex bundle auto register 2021-04-17 17:57:12 +02:00
KHOUBZA Younes 5492d30374 update composer.json 2021-04-16 20:26:48 +02:00
KHOUBZA Younes 7ff1ec4fc1 clean up code 2021-04-16 20:08:36 +02:00
KHOUBZA Younes e6237cbe42 refactor symfony bundle configuration and response manager 2021-02-09 05:15:19 +01:00
Khoubza Younes 09fc4d6ec5 update home page 2020-12-17 11:26:35 +01:00
Khoubza Younes 1dac7bfdbb update README.md for all packages 2020-12-17 11:22:04 +01:00
Khoubza Younes b6ff681393 add open_collective to FUNDING.yml 2020-12-17 11:02:48 +01:00
Khoubza Younes 3e0b49d9db update README.md for all packages 2020-12-17 11:00:17 +01:00
Khoubza Younes ff48db2429 run tests on stable versions 2020-12-16 08:58:28 +01:00
Khoubza Younes 669e389677 run tests on stable versions 2020-12-16 08:48:36 +01:00
KHOUBZA Younes a19f4c4da1 update tests 2020-12-15 15:17:00 +01:00
KHOUBZA Younes 7e5116eaed update factories and add tailwindcss template 2020-12-15 15:00:08 +01:00
15 changed files with 189 additions and 180 deletions
+1
View File
@@ -2,4 +2,5 @@
patreon: yoeunes
ko_fi: yoeunes
open_collective: php-flasher
custom: ['https://www.paypal.com/paypalme/yoeunes']
+7
View File
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
+5 -6
View File
@@ -4,7 +4,7 @@ on:
push:
pull_request:
schedule:
- cron: '0 * * * *'
- cron: '* * * * *'
jobs:
test:
@@ -13,7 +13,6 @@ jobs:
fail-fast: true
matrix:
symfony: [5.2.*, 5.1.*, 5.0.*, 4.4.*, 4.3.*, 4.2.*, 4.1.*, 4.0.*, 3.4.*, 3.3.*, 3.2.*, 3.1.*, 3.0.*, 2.8.*, 2.7.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- symfony: 5.2.*
php: 7.2
@@ -75,7 +74,7 @@ jobs:
php: 5.3
phpunit: 4.8.36
name: S${{ matrix.symfony }} - P${{ matrix.php }} - ${{ matrix.dependency-version }}
name: S${{ matrix.symfony }} - P${{ matrix.php }}
steps:
- name: Checkout code
@@ -96,9 +95,9 @@ jobs:
- name: Install dependencies
run: |
COMPOSER_MEMORY_LIMIT=-1 composer require "symfony/symfony:${{ matrix.symfony }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update
COMPOSER_MEMORY_LIMIT=-1 composer config extra.symfony.require "${{ matrix.symfony }}"
COMPOSER_MEMORY_LIMIT=-1 composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
composer require "symfony/symfony:${{ matrix.symfony }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update
composer config extra.symfony.require "${{ matrix.symfony }}"
composer update --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/phpunit
+2 -2
View File
@@ -1,5 +1,5 @@
.idea/
vendor/
.idea
vendor
composer.lock
.phpunit.result.cache
.phpcs-cache
+5 -44
View File
@@ -26,59 +26,20 @@ final class Configuration implements ConfigurationInterface
->arrayNode('scripts')
->prototype('scalar')->end()
->defaultValue(array(
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js',
'/bundles/flashertoastr/flasher-toastr.js',
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js',
'https://cdn.jsdelivr.net/npm/@flasher/flasher-toastr@0.1.3/dist/flasher-toastr.min.js',
))
->end()
->arrayNode('styles')
->prototype('scalar')->end()
->defaultValue(array(
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css',
))
->defaultValue(array())
->end()
->arrayNode('options')
->prototype('variable')->end()
->ignoreExtraKeys(false)
->defaultValue(array(
'closeButton' => true,
'closeClass' => 'toast-close-button',
'closeDuration' => 300,
'closeEasing' => 'swing',
'closeHtml' => '<button><i class="icon-off"></i></button>',
'closeMethod' => 'fadeOut',
'closeOnHover' => true,
'containerId' => 'toast-container',
'debug' => false,
'escapeHtml' => false,
'extendedTimeOut' => 10000,
'hideDuration' => 1000,
'hideEasing' => 'linear',
'hideMethod' => 'fadeOut',
'iconClass' => 'toast-info',
'iconClasses' => array(
'error' => 'toast-error',
'info' => 'toast-info',
'success' => 'toast-success',
'warning' => 'toast-warning',
),
'messageClass' => 'toast-message',
'newestOnTop' => false,
'onHidden' => null,
'onShown' => null,
'positionClass' => 'toast-top-right',
'preventDuplicates' => false,
'progressBar' => true,
'progressClass' => 'toast-progress',
'rtl' => false,
'showDuration' => 300,
'showEasing' => 'swing',
'showMethod' => 'fadeIn',
'tapToDismiss' => true,
'target' => 'body',
'timeOut' => 5000,
'titleClass' => 'toast-title',
'toastClass' => 'toast',
'progressBar' => true,
'timeOut' => 5000,
))
->end()
->end()
+8 -28
View File
@@ -2,44 +2,24 @@
namespace Flasher\Toastr\Symfony\DependencyInjection;
use Flasher\Symfony\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
final class FlasherToastrExtension extends Extension implements PrependExtensionInterface
final class FlasherToastrExtension extends Extension
{
/**
* {@inheritdoc}
*
* @throws \Exception
* @inheritDoc
*/
public function load(array $configs, ContainerBuilder $container)
protected function getConfigFileLocator()
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('config.yaml');
$configuration = new Configuration();
$this->processConfiguration($configuration, $configs);
return new FileLocator(__DIR__.'/../Resources/config');
}
/**
* {@inheritdoc}
* @inheritDoc
*/
public function prepend(ContainerBuilder $container)
protected function getConfigClass()
{
if (!$container->hasExtension('flasher')) {
throw new \RuntimeException('[Flasher\Symfony\FlasherBundle] is not registered');
}
$configs = $container->getExtensionConfig($this->getAlias());
$config = $this->processConfiguration(new Configuration(), $configs);
$container->prependExtensionConfig('flasher', array(
'adapters' => array(
'toastr' => $config,
),
));
return new Configuration();
}
}
-9
View File
@@ -1,9 +0,0 @@
<?php
namespace Flasher\Toastr\Symfony;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class FlasherToastrBundle extends Bundle
{
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace Flasher\Toastr\Symfony;
use Flasher\Toastr\Symfony\DependencyInjection\FlasherToastrExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class FlasherToastrSymfonyBundle extends Bundle
{
public function getContainerExtension()
{
return new FlasherToastrExtension();
}
}
+50 -14
View File
@@ -1,12 +1,16 @@
<p align="center"><img width="600" alt="notify" src="https://user-images.githubusercontent.com/10859693/100492861-fabfd800-3130-11eb-8c5e-242fff1706a9.png"></p>
<p align="center"><img width="600" alt="flasher" src="https://user-images.githubusercontent.com/10859693/102468596-03317180-4052-11eb-9df3-44dc6235b238.png"></p>
<h1 align="center">Easy flash notifications for PHP, Laravel, Symfony, Lumen</h1>
<h1 align="center">A powerful and flexible flash notifications system for PHP, Laravel, Symfony</h1>
<p align="center">: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.</p>
<p align="center">
:eyes: PHP Flasher helps you to add flash notifications to your PHP 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.
</p>
<p align="center">
<a href="https://github.com/php-flasher/flasher">
<img src="https://img.shields.io/badge/source-php--notify/notify-blue.svg?style=flat-square">
<img src="https://img.shields.io/badge/source-php--flasher/flasher-blue.svg?style=flat-square">
</a>
<a href="https://github.com/php-flasher/flasher/releases">
<img src="https://img.shields.io/github/tag/php-flasher/flasher.svg">
@@ -20,32 +24,64 @@
<a href="https://packagist.org/packages/php-flasher/flasher">
<img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg?style=flat-square">
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/backer/badge.svg?label=backer&color=brightgreen" />
</a>
<a href="https://opencollective.com/php-flasher">
<img src="https://opencollective.com/php-flasher/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen" />
</a>
</p>
## 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.
The PHP Flasher project supports many notification libraries : __tailwindcss__, __bootstrap__, __toastr.js__, __sweet alert 2__, __pnotify__, __noty__, and __notyf__
and its highly extendable so you can add your custom notifications.
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
> * Render notification from JSON object
> * Limit the number of displayed notifications
> * Show notifications from different adapters at the same time
> * implementations for popular frameworks : Symfony and Laravel
> * Show notifications from different libraries at the same time
> * Framework angostic with integration for : Symfony and Laravel
> * Support templates
> * Easy migration from similar libraries.
> * Very flexible so you can add you own adapters
> * ...and more
## Official Documentation
Documentation for Valet can be found on the [PHP Flasher website](https://php-flasher.github.io/).
Documentation for PHP Flasher can be found on the [PHP Flasher website](https://php-flasher.github.io/).
## Backers && Sponsors
Support this project by becoming a sponsor. Your name will show up in the Contribute page of all PHP Flasher installations as well as here with a link to your website!
Thank you to all our backers and sponsors! 🙏
<a href="https://opencollective.com/php-flasher#backers" target="_blank">
<img src="https://opencollective.com/php-flasher/backers.svg?width=890" title="Backers" alt="Backers">
</a>
<a href="https://opencollective.com/php-flasher#sponsors" target="_blank">
<img src="https://opencollective.com/php-flasher/sponsors.svg?width=890" title="Sponsors" alt="Sponsors">
</a>
### Contact
PHP Flasher is being actively developed by <a href="https://github.com/yoeunes">yoeunes</a>. You can reach out with questions, bug reports, or feature requests
on any of the following:
- [Github Issues](https://github.com/php-flasher/flasher/issues)
- [Github](https://github.com/yoeunes)
- [Twitter](https://twitter.com/yoeunes)
- [Linkedin](https://www.linkedin.com/in/younes-khoubza/)
- [Email me directly](mailto:younes.khoubza@gmail.com)
## License
PHP Flasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes-khoubza/">Younes KHOUBZA</a> <b> </p>
+1 -1
View File
@@ -1,6 +1,6 @@
services:
flasher.toastr:
parent: 'flasher.abstract_factory'
parent: 'flasher.notification_factory'
class: Flasher\Toastr\Prime\ToastrFactory
tags:
- { name: 'flasher.factory', alias: 'toastr' }
-15
View File
@@ -1,15 +0,0 @@
PHPFlasher.addFactory('toastr', (function () {
'use strict';
var exports = {};
exports.render = function (data) {
toastr[data.type](data.message, data.title, data.options);
};
exports.renderOptions = function (options) {
toastr.options = options;
};
return exports;
})());
@@ -13,54 +13,15 @@ class ConfigurationTest extends TestCase
$config = $this->process(array());
$expected = array(
'scripts' => array(
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js',
'/bundles/flashertoastr/flasher-toastr.js',
'scripts' => array(
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js',
'https://cdn.jsdelivr.net/npm/@flasher/flasher-toastr@0.1.3/dist/flasher-toastr.min.js',
),
'styles' => array(
'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css',
),
'options' =>array(
'closeButton' => true,
'closeClass' => 'toast-close-button',
'closeDuration' => 300,
'closeEasing' => 'swing',
'closeHtml' => '<button><i class="icon-off"></i></button>',
'closeMethod' => 'fadeOut',
'closeOnHover' => true,
'containerId' => 'toast-container',
'debug' => false,
'escapeHtml' => false,
'extendedTimeOut' => 10000,
'hideDuration' => 1000,
'hideEasing' => 'linear',
'hideMethod' => 'fadeOut',
'iconClass' => 'toast-info',
'iconClasses' => array(
'error' => 'toast-error',
'info' => 'toast-info',
'success' => 'toast-success',
'warning' => 'toast-warning',
),
'messageClass' => 'toast-message',
'newestOnTop' => false,
'onHidden' => null,
'onShown' => null,
'positionClass' => 'toast-top-right',
'preventDuplicates' => false,
'progressBar' => true,
'progressClass' => 'toast-progress',
'rtl' => false,
'showDuration' => 300,
'showEasing' => 'swing',
'showMethod' => 'fadeIn',
'tapToDismiss' => true,
'target' => 'body',
'timeOut' => 5000,
'titleClass' => 'toast-title',
'toastClass' => 'toast',
)
'styles' => array(),
'options' => array(
'progressBar' => true,
'timeOut' => 5000,
)
);
$this->assertSame($expected, $config);
@@ -4,9 +4,9 @@ namespace Flasher\Toastr\Symfony\Tests\DependencyInjection;
use Flasher\Prime\Tests\TestCase;
use Flasher\Symfony\DependencyInjection\FlasherExtension;
use Flasher\Symfony\FlasherBundle;
use Flasher\Symfony\FlasherSymfonyBundle;
use Flasher\Toastr\Symfony\DependencyInjection\FlasherToastrExtension;
use Flasher\Toastr\Symfony\FlasherToastrBundle;
use Flasher\Toastr\Symfony\FlasherToastrSymfonyBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class FlasherToastrExtensionTest extends TestCase
@@ -31,17 +31,14 @@ class FlasherToastrExtensionTest extends TestCase
$flasher = $container->getDefinition('flasher');
$calls = $flasher->getMethodCalls();
$this->assertCount(1, $calls);
$this->assertCount(2, $calls);
$this->assertSame('addFactory', $calls[0][0]);
$this->assertSame('toastr', $calls[0][1][0]);
$this->assertSame('flasher.toastr', (string) $calls[0][1][1]);
}
$this->assertSame('template', $calls[0][1][0]);
$this->assertSame('flasher.notification_factory', (string) $calls[0][1][1]);
public function testConfigurationInjectedIntoFlasherConfig()
{
$container = $this->getContainer();
$config = $container->get('flasher.config');
$this->assertNotEmpty($config->get('adapters.toastr'));
$this->assertSame('addFactory', $calls[1][0]);
$this->assertSame('toastr', $calls[1][1][0]);
$this->assertSame('flasher.toastr', (string) $calls[1][1][1]);
}
private function getRawContainer()
@@ -49,11 +46,11 @@ class FlasherToastrExtensionTest extends TestCase
$container = new ContainerBuilder();
$container->registerExtension(new FlasherExtension());
$flasherBundle = new FlasherBundle();
$flasherBundle = new FlasherSymfonyBundle();
$flasherBundle->build($container);
$container->registerExtension(new FlasherToastrExtension());
$adapterBundle = new FlasherToastrBundle();
$adapterBundle = new FlasherToastrSymfonyBundle();
$adapterBundle->build($container);
$container->getCompilerPassConfig()->setOptimizationPasses(array());
@@ -66,6 +63,8 @@ class FlasherToastrExtensionTest extends TestCase
private function getContainer()
{
$container = $this->getRawContainer();
$container->loadFromExtension('flasher', array());
$container->loadFromExtension('flasher_toastr', array());
$container->compile();
return $container;
+1 -1
View File
@@ -17,7 +17,7 @@
"bundle",
"flex"
],
"homepage": "https://github.com/php-flasher/flasher-symfony-toastr",
"homepage": "https://php-flasher.github.io/",
"authors": [
{
"name": "Younes Khoubza",
+75
View File
@@ -0,0 +1,75 @@
{
"name": "php-flasher/flasher-toastr-symfony",
"type": "symfony-bundle",
"description": "PHP Flasher Symfony adapter for Toastr",
"keywords": [
"yoeunes",
"notify",
"php",
"laravel",
"symfony",
"Lumen",
"notifications",
"messages",
"alerts",
"pnotify",
"toastr ",
"bundle",
"flex"
],
"homepage": "https://php-flasher.github.io/",
"authors": [
{
"name": "Younes Khoubza",
"email": "younes.khoubza@gmail.com",
"homepage": "https://github.com/yoeunes",
"role": "Developer"
}
],
"license": "MIT",
"repositories": [
{
"type": "path",
"url": "../../Symfony",
"options": {
"symlink": true
}
},
{
"type": "path",
"url": "../Prime",
"options": {
"symlink": true
}
}
],
"require": {
"php": ">=5.3",
"php-flasher/flasher-symfony": "@dev",
"php-flasher/flasher-toastr": "@dev"
},
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0|^6.0|^7.0|^8.0|^9.0"
},
"autoload": {
"psr-4": {
"Flasher\\Toastr\\Symfony\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"autoload-dev": {
"psr-4": {
"Flasher\\Toastr\\Symfony\\Tests\\": "Tests/"
}
},
"config": {
"sort-packages": true,
"platform": {
"php": "5.3.10"
}
},
"minimum-stability": "dev",
"prefer-stable": true
}