lexty / flashybundle
Flash notifications
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-11-09 19:51:01 UTC
README
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require lexty/flashybundle "dev-master"
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Lexty\FlashyBundle\LextyFlashyBundle(), ); // ... } // ... }
Step 3: Include CSS and JS
Call the function lexty_flashy_render()
in template:
<!-- app/Resources/views/base.html.twig --> <body> ... {{ lexty_flashy_render()|raw }} ... </body>
Usage
Server side
// src/AppBundle/Controller/DefaultController.php public function indexAction() { $flashy = $this->container->get('lexty_flashy'); $flashy->add('Test message!', Flashy::TYPE_SUCCESS); // ... }
Client side
flashy.add('Success message!', 'success');
Available styles
Flashy::TYPE_INFO
(info
)Flashy::TYPE_SUCCESS
(success
)Flashy::TYPE_WARNING
(warning
)Flashy::TYPE_ERROR
(error
)Flashy::TYPE_MUTED
(muted
)Flashy::TYPE_MUTED_DARK
(muted-dark
)Flashy::TYPE_PRIMARY
(primary
)Flashy::TYPE_PRIMARY_DARK
(primary-dark
)
Configuration
# config/config.yml lexty_flashy: delay: 2800 # while displaying flash messages (in milliseconds)
License
MIT