2017 © Pedro Peláez
 

library zend-flashmessenger-toastr

Zend Framework 3 flashmessenger module with Toastr integration

image

seyfer/zend-flashmessenger-toastr

Zend Framework 3 flashmessenger module with Toastr integration

  • Sunday, March 19, 2017
  • by seyfer
  • Repository
  • 1 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Zend Framework 3 FlashMessenger module with integrated Toastr js library

Motivation

  1. I had a problem with official ZF3 FlashMessenger module and decided to write own independent module. As a basis for flash messages, I got a simple pure PHP library. https://github.com/plasticbrain/PhpFlashMessages, (*1)

  2. I wanted to integrate Toastr js library for better flash messages UI. And make it easy to switch between Toastr view and standard bootstrap view. https://codeseven.github.io/toastr/, (*2)

If you want to use standard ZF3 Flashmessanger there is another module available. https://github.com/jenzri-nizar/zf3-flashmessenger, (*3)


This is how it will look like with Toastr view., (*4)

screen shot Toastr, (*5)

And this is Bootstrap, (*6)

screen shot Bootstrap, (*7)

Installation

composer require seyfer/zend-flashmessenger-toastr, (*8)

Than add module to your config/modules.config.php, (*9)

'modules' => [
    '...',
    'Seyfer\Zend\Flashmessenger'
],

You can switch the source of Toastr lib files by using this config in your module.config.php, (*10)

'toastr' => [
    //cdn or assets
    'source' => 'cdn',
],

How to use it

Add messages somewhere in your controller with provided plugin., (*11)

<?php
$this->msg()->addSuccessMessage('test');
$this->msg()->addErrorMessage('test');
$this->msg()->addInfoMessage('test');
$this->msg()->addWarningMessage('test');

If you want output Toastr style messages just use provided view helper method in your layout.phtml. Also, you need inlineSript helper to be included., (*12)

 <?php $this->msg()->renderToastr(); ?>
 <?php echo $this->inlineScript() ?>

For a standard Bootstrap, view uses another method., (*13)

 <?php $this->msg()->renderToastr(); ?>
 <?php echo $this->inlineScript() ?>

That's it!, (*14)

Please, don't hesitate to contribute and send pull requests., (*15)

The Versions

19/03 2017

dev-master

9999999-dev http://seyferseed.ru/

Zend Framework 3 flashmessenger module with Toastr integration

  Sources   Download

MIT

The Requires

 

by Oleg Abrazhaev

zend toastr zend framework 3 flashmessenger