PHP code example of zunnu / cake-toastr

1. Go to this page and download the library: Download zunnu/cake-toastr 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/ */

    

zunnu / cake-toastr example snippets


<?= $this->Flash->render() 

$this->Flash = $this->loadComponent('CakeToastr.Toastr', ['alias' => 'Flash']);

$this->loadHelper('CakeToastr.Toastr', ['progressBar' => true]);

$this->Flash->warning('This is a custom success message');

$this->loadHelper('CakeToastr.Toastr', [
    'positionClass' => 'toast-bottom-center',
    'callbacks' => [
        'onShown' => 'function() {
            console.log("Toastr notification displayed");
        }'
    ]
]);

$this->loadHelper('CakeToastr.Toastr', [
    'positionClass' => 'toast-bottom-center',
    'customCss' => '
        .toast-bottom-center {
            bottom: 8%;
        }
        .toast-bottom-center .toast {
            min-width: 600px;
        }
    ',
    'callbacks' => [
        'onShown' => 'function() {
            console.log("Custom styles applied and Toastr notification shown");
        }'
    ]
]);

$this->loadHelper('CakeToastr.Toastr', [
    'positionClass' => 'toast-bottom-center',
    'customCss' => '
        .toast-bottom-center {
            bottom: 8%;
        }
        .toast-bottom-center .toast {
            min-width: 600px;
        }
    ',
    'callbacks' => [
        'onShown' => 'function() {
            $(".toast-bottom-center .toast").css("background-color", "#333");
            console.log("Custom background color applied and Toastr notification shown");
        }'
    ]
]);