PHP code example of szykra / notifications

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

    

szykra / notifications example snippets


'Szykra\Notifications\NotificationServiceProvider'

'Flash' => 'Szykra\Notifications\Flash'

@

Flash::info('Your alert message here!');

Flash::success('User has been updated successfully.');
Flash::error('Oh snap!', 'Something went wrong. Please try again for a few seconds.');

@if(Session::has('flash.alerts'))
    @foreach(Session::get('flash.alerts') as $alert)

        <div class='alert alert-{{ $alert['level'] }}'>
            <button class="close" type="button" data-dismiss="alert" aria-hidden="true">&times;</button>

            @if( ! empty($alert['title']))
                <div><strong>{{ $alert['title'] }}</strong></div>
            @endif

            {{ $alert['message'] }}
        </div>

    @endforeach
@endif

[
  'title' => 'Title',
  'message' => 'Example message',
  'level' => 'success'
]