zf-hipsters / bootstrap-flash-messenger
Simple implementation of ZF2 flash messengers using bootstrap. Contains easy helpers that will save you a LOT of time.
Installs: 8 264
Dependents: 1
Suggesters: 0
Security: 0
Stars: 14
Watchers: 4
Forks: 1
Open Issues: 3
Requires
- php: >=5.3.3
- zendframework/zendframework: >2.2.0rc1
This package is not auto-updated.
Last update: 2024-12-17 02:13:13 UTC
README
A simple module that makes flash messengers as simple as they are in CakePHP. And the best part is it generates beautifully formatted Bootstrap alerts!
Installation
- Add the following requirement to your projects composer.json file.
Within the "require" section:
"zf-hipsters/bootstrap-flash-messenger": ">=1.0"
- Open up your command line and run
php ./composer.phar update
- Add 'FlashMessenger' to your /config/application.config.php modules
Controller Plugin Examples
Simple success (this is the default namespace)
$this->fm('You have been logged in.'); return $this->redirect()->toRoute('dashboard');
Error
$this->fm('Your username and/or password were incorrect.', 'error'); return $this->redirect()->toRoute('authorize/login');
Info
$this->fm('Something cool happened!', 'info'); return $this->redirect()->toRoute('home');
Warning
$this->fm('Careful! Something bad could happen!', 'warning'); return $this->redirect()->toRoute('dashboard');
View Helper Example
Default usage
<?=$this->fm()?>
Custom Namespace(s)
<?=$this->fm('exciting_namespace')?>
<?=$this->fm(array('mynamespace1', 'mynamespace2'))?>
Customising templates
Customising templates and changing the titles is super easy! Ensure that FlashMessenger is somewhere at the top of your list in application.config.php Now, copy the vendor/zf-hipsters/bootstrap-flash-messenger/view/flash-messenger folder to your eg module/application/view folder.
That's it, customise to your hearts content and they will overload the default files!