2017 © Pedro Peláez
 

symfony-bundle flashybundle

Flash notifications

image

lexty/flashybundle

Flash notifications

  • Monday, January 25, 2016
  • by Lexty
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

FlashyBundle

screenshot, (*1)

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:, (*2)

$ 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., (*3)

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:, (*4)

<?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:, (*5)



<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, (*6)

The Versions

25/01 2016

dev-master

9999999-dev

Flash notifications

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Alexandr Medvedev