PHP code example of errehub / laravel-alert

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

    

errehub / laravel-alert example snippets


    use Errehub\LaravelAlert\AlertFacade as Notifier; // Import the Facade
    use Errehub\LaravelAlert\Alert; // Import the Alert class

    class AuthController
    {
        public function login()
        {
            // Using the AlertFacade via the Notifier alias:
            Notifier::success('You have logged in successfully');
            Notifier::error('Sorry, something went wrong. Please try again.');
            Notifier::info('You have a new notification');
            Notifier::warning('Please confirm if you want to proceed');

            // Using the Alert class directly:
            $alert = new Alert();
            $alert->success('Welcome, Youssef Erremili!');
            $alert->error('An error occurred.');
            $alert->info('This is an informational message.');
            $alert->warning('This is a warning message.');

            // Or alternatively:
            $alertMessage = (new Alert())->success('Welcome back!');
        }
    }
shell
  php artisan vendor:publish --tag=public
shell
  php artisan vendor:publish --tag=views