wahyudedik/laravel-alert

A beautiful and easy-to-use alert notification library for Laravel with Blade integration

Fund package maintenance!
wahyudedik

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/wahyudedik/laravel-alert

dev-main / 1.0.x-dev 2025-09-24 18:39 UTC

This package is auto-updated.

Last update: 2025-12-24 19:19:31 UTC


README

A comprehensive Laravel package for managing alerts and notifications with support for multiple themes, animations, and real-time updates.

โœจ Features

  • Multiple Alert Types - Success, Error, Warning, Info
  • Blade Integration - Components and Directives
  • Multiple Themes - Bootstrap, Tailwind, Bulma
  • Animations - Fade, Slide, Bounce, and more
  • Real-time Updates - WebSocket and AJAX support
  • Database Storage - Persistent alert storage
  • Cache Integration - Redis and Cache support
  • REST API - Full API support with authentication
  • Admin Panel - Alert management interface
  • Performance Optimization - High-performance features

Installation

composer require wahyudedik/laravel-alert 

Configuration

Publish the configuration file:

php artisan vendor:publish --provider="Wahyudedik\LaravelAlert\AlertServiceProvider" --tag="laravel-alert-config"

Usage

Using the Facade

use Wahyudedik\LaravelAlert\Facades\Alert;

// Success alert
Alert::success('Operation completed successfully!');

// Error alert
Alert::error('Something went wrong!');

// Warning alert
Alert::warning('Please check your input.');

// Info alert
Alert::info('Welcome to our application!');

// Custom alert
Alert::add('custom', 'This is a custom alert!');

Using Blade Components

<!-- Single alert -->
<x-alert type="success" dismissible>
    Your changes have been saved!
</x-alert>

<!-- Display all alerts -->
<x-alerts />

Using Blade Directives

<!-- Single alert directive -->
@alert('info', 'Welcome to our application!')

<!-- Display all alerts -->
@alerts

<!-- Conditional alert -->
@alertIf($user->isNew(), 'success', 'Welcome to our platform!')

Configuration Options

// config/laravel-alert.php
return [
    'default_theme' => 'bootstrap', // bootstrap, tailwind, bulma
    'auto_dismiss' => true,
    'dismiss_delay' => 5000, // milliseconds
    'animation' => 'fade', // fade, slide, bounce, none
    'position' => 'top-right', // top-right, top-left, bottom-right, bottom-left, top-center, bottom-center
    'max_alerts' => 5,
    'session_key' => 'laravel_alerts',
];

Themes

Bootstrap

<x-alert type="success">Success message</x-alert>
<x-alert type="error">Error message</x-alert>
<x-alert type="warning">Warning message</x-alert>
<x-alert type="info">Info message</x-alert>

Tailwind CSS

<x-alert type="success" class="bg-green-50 text-green-800 border-green-200">
    Success message
</x-alert>

Advanced Usage

Custom Options

Alert::success('Message', 'Title', [
    'dismissible' => true,
    'icon' => 'fas fa-check',
    'class' => 'custom-alert-class',
    'style' => 'border-left: 4px solid #28a745;'
]);

Custom Themes

You can create custom themes by publishing the views:

php artisan vendor:publish --provider="Wahyudedik\LaravelAlert\AlertServiceProvider" --tag="laravel-alert-views"

Requirements

  • PHP 8.0+
  • Laravel 9.0+
  • Bootstrap 4/5 (for Bootstrap theme)
  • Tailwind CSS (for Tailwind theme)

License

MIT License. See LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“š Documentation

๐Ÿ“– Complete Documentation

For comprehensive documentation, visit our documentation site.

๐Ÿ“ Documentation Structure

docs/
โ”œโ”€โ”€ README.md              # Main documentation index
โ”œโ”€โ”€ installation.md        # Installation guide
โ”œโ”€โ”€ api.md                 # API documentation
โ”œโ”€โ”€ examples.md            # Code examples
โ”œโ”€โ”€ contributing.md        # Contributing guide
โ”œโ”€โ”€ changelog.md           # Version history
โ”œโ”€โ”€ mkdocs.yml            # MkDocs configuration
โ”œโ”€โ”€ package.json          # Node.js dependencies
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”œโ”€โ”€ Dockerfile            # Docker configuration
โ”œโ”€โ”€ docker-compose.yml    # Docker Compose configuration
โ”œโ”€โ”€ Makefile              # Build automation
โ””โ”€โ”€ .gitignore            # Git ignore rules

๐Ÿ› ๏ธ Documentation Development

The documentation is built using MkDocs with the Material theme.

Local Development

# Navigate to docs directory
cd docs/

# Install dependencies
make install

# Start development server
make dev

# Build documentation
make build

# Deploy to GitHub Pages
make deploy

Docker Development

# Start with Docker
make docker-dev

# Build with Docker
make docker-build

# Deploy with Docker
make docker-deploy

Available Commands

make help          # Show all available commands
make dev           # Start development server
make build         # Build documentation
make deploy        # Deploy to GitHub Pages
make clean         # Clean build files
make lint          # Lint markdown files
make spell         # Check spelling
make test          # Run tests
make preview       # Preview built documentation

๐ŸŽฏ Key Features

Core Features

  • โœ… Multiple Alert Types - Success, Error, Warning, Info
  • โœ… Blade Integration - Components and Directives
  • โœ… Multiple Themes - Bootstrap, Tailwind, Bulma
  • โœ… Animations - Fade, Slide, Bounce, and more
  • โœ… Auto-dismiss - Configurable auto-dismissal
  • โœ… Session Storage - Built-in session management

Advanced Features

  • โœ… Database Storage - Persistent alert storage
  • โœ… Cache Integration - Redis and Cache support
  • โœ… REST API - Full API support
  • โœ… Real-time Updates - WebSocket integration
  • โœ… Admin Panel - Alert management interface
  • โœ… Performance Optimization - High-performance features

Integration Features

  • โœ… Third-party Services - Pusher, WebSocket, Email
  • โœ… Authentication - Multiple auth methods
  • โœ… Rate Limiting - Built-in rate limiting
  • โœ… CORS Support - Cross-origin requests
  • โœ… Webhook Support - External integrations

๐Ÿ“ก API Usage

# Get all alerts
GET /api/v1/alerts

# Create alert
POST /api/v1/alerts
{
    "type": "success",
    "message": "Operation completed!",
    "title": "Success"
}

# Dismiss alert
POST /api/v1/alerts/{id}/dismiss

๐Ÿงช Testing

# Run tests
composer test

# Run with coverage
composer test-coverage

# Run performance tests
composer test-performance

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

๐Ÿ“Š Statistics

  • Version: 1.0.0
  • PHP Version: 8.1+
  • Laravel Version: 9.0+
  • License: MIT
  • Stars: โญ (GitHub)
  • Downloads: ๐Ÿ“ฆ (Packagist)

Made with โค๏ธ by Wahyudedik