Alerts

prologue/alerts image

Alerts stats

Downloads
3.3M
Stars
343
Open Issues
4
Forks
35

View on GitHub →

Prologue Alerts is a package that handles global site messages.

Prologue Alerts for Laravel

Prologue Alerts is a Laravel package designed to facilitate the creation and management of global site messages across Laravel versions 5 through 9. It leverages an intuitive API for triggering notification bubbles that can be displayed immediately or flashed to the session for future display.

Key Features:

  • Compatibility: Supports Laravel versions 5 to 9, ensuring broad usability across different projects.
  • Ease of Use: Utilizes a simple API to add alerts via predefined or custom alert levels such as success, error, warning, and info.
  • Flexibility: Alerts can be added directly or flashed to the session for display after redirects, enhancing user experience in multi-page scenarios.
  • Integration: Extends Illuminate’s MessageBag class, allowing for the use of all its methods to manage messages efficiently.
  • Customizable Alert Levels: Comes with default alert levels and allows for the addition of custom levels through configuration modifications.

Installation:

For Laravel 6 and newer:

composer require prologue/alerts

For Laravel 5.4 and below, registration of the service provider and facade is necessary in app/config/app.php:

'Prologue\Alerts\AlertsServiceProvider',
'Alert' => 'Prologue\Alerts\Facades\Alert',

Configuration:

Generate the configuration file with:

php artisan vendor:publish --provider="Prologue\Alerts\AlertsServiceProvider"

This action creates a config file at config/prologue/alerts.php where custom alert levels and other settings can be defined.

Usage Highlights:

  • Adding Alerts: Simple API to add messages.
    Alert::error('Error message');
  • Flashing Alerts: Store alerts in the session to be displayed after a redirect.
    Alert::success('You have successfully logged in')->flash();
  • Displaying Alerts: Use Laravel’s view system to loop through and display alerts.
    @foreach (Alert::all() as $alert)
    {{ $alert }}
    @endforeach

Practical Applications:

  • Check for the presence of alerts, useful for conditionally loading resources.
  • Count alerts by type, aiding in granular control over alert handling.

Credits: Developed by Dries Vints, with ongoing maintenance by Cristian Tabacitu, this package is inspired by concepts from Todd Francis and integrates seamlessly with Laravel's ecosystem.

This package is ideal for developers looking to implement responsive, session-based notification systems in their Laravel applications, streamlining the user experience with minimal setup.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Prologue Alerts Related Articles

Resources for Getting Up To Speed with Laravel 11 image

Resources for Getting Up To Speed with Laravel 11

Read article
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
The Certification of Competence for Laravel logo

The Certification of Competence for Laravel

A community-driven, proctored assessment across 4 levels designed to validate real-world Laravel knowledge, from Junior to mastery-level Artisan. Official Vue.js, Official Nuxt, Angular, React, JS certifications also available.

The Certification of Competence for Laravel
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search