ankurk91 / laravel-alert
A Bootstrap alert helper for Laravel php framework
Installs: 1 198
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^8.2
- illuminate/session: ^10 || ^11
- illuminate/support: ^10|| ^11
Requires (Dev)
- mockery/mockery: ^1.4.2
- phpunit/phpunit: ^9.5
README
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.