ankurk91/laravel-alert

A Bootstrap alert helper for Laravel php framework

2.9.0 2024-03-05 07:45 UTC

This package is auto-updated.

Last update: 2024-03-05 07:46:43 UTC


README

GitHub tag Packagist Downloads License tests codecov

A Bootstrap CSS alert helper for Laravel

Installation

You can install the package via composer:

composer require "ankurk91/laravel-alert"

Include the alert view within your view blade templates.

@include('alert::bootstrap')

Usage examples

You can use facade.

<?php
use Ankurk91\LaravelAlert\Facades\Alert;

Alert::error('Something went wrong.');
Alert::danger('I am same as error.');
Alert::success('Contact saved.');
Alert::warning('You are running late.');
Alert::info('Order dispatched.');

There is also a global helper function if you prefer.

<?php

alert()->info('Use anywhere without facade.');

alert('You can use the <b>html</b> tags like this too.', 'danger');

BootstrapVue support

The package include the template to support bootstrap vue alert component.

Import the required javascript components.

// resources/js/bootstrap.js
import {AlertPlugin} from 'bootstrap-vue'

Vue.use(AlertPlugin)

Update your blade template like:

@include('alert::bootstrapVue')

Alpine.js support

Add alpine.js script to your blade template

# use a CDN or install via npm
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.8/dist/cdn.min.js"></script>

Update your blade template like:

@include('alert::bootstrapAlpine')

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

composer test

Security

If you discover any security issues, please email pro.ankurk1[at]gmail[dot]com instead of using the issue tracker.

Attribution

Original code taken from vinkla/laravel-alert

License

The MIT License.