PHP code example of newton-labs / alertify-bundle

1. Go to this page and download the library: Download newton-labs/alertify-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

newton-labs / alertify-bundle example snippets


use Troopers\AlertifyBundle\Controller\AlertifyControllerTrait;

class MyController extends ...
{
    use AlertifyControllerTrait;

    /* You can use then all methods :
     * $this->alert("hello", $type = 'success');
     * $this->congrat("Congratulation");
     * $this->warn("Warning !");
     * $this->inform("Did you know ?");
     * $this->scold("What's wrong with you !");
     */
}

    class BaseFrontController
    {
        /**
         * congrat user through flashbag : all happened successfully
         * Will automatically inject context
         * @param string $content
         */
        public function congrat($content)
        {
            $content = array('body' => $content, 'context' => 'front');
            $this->get('av.shortcuts')->congrat($content);
        }
    }