https://github.com/mikebronner/laravel-messenger
Notifying your users doesn't have to be a lot of work.
https://github.com/mikebronner/laravel-messenger
alerts laravel-5-package notifications package php7
Last synced: 6 months ago
JSON representation
Notifying your users doesn't have to be a lot of work.
- Host: GitHub
- URL: https://github.com/mikebronner/laravel-messenger
- Owner: mikebronner
- License: mit
- Created: 2014-08-03T03:15:13.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2021-06-08T22:50:12.000Z (over 4 years ago)
- Last Synced: 2024-10-29T16:41:43.583Z (11 months ago)
- Topics: alerts, laravel-5-package, notifications, package, php7
- Language: PHP
- Homepage:
- Size: 108 KB
- Stars: 135
- Watchers: 7
- Forks: 15
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Messenger for Laravel
[](https://gitter.im/GeneaLabs/laravel-messenger?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://travis-ci.org/GeneaLabs/laravel-messenger)
[](https://insight.sensiolabs.com/projects/90b80280-406d-419e-b02a-5debc51e709d/analyses/1)
[](https://scrutinizer-ci.com/g/GeneaLabs/laravel-messenger)
[](https://coveralls.io/github/GeneaLabs/laravel-messenger)
[](https://github.com/GeneaLabs/laravel-messenger)
[](https://packagist.org/packages/genealabs/laravel-messenger)
## Goal
To provide a drop-in, application-wide alerting functionality to display various
types of alerts and notifications to the user in response to their actions.## Prerequisites
- Bootstrap 3 or 4
- Laravel 5.5 or 5.6
- PHP >= 7.1.3## Features
- Feedback notifications in form of bootstrap alerts or modals.
- Send notifications from facade, app IoC reference, or blade
directive.
- Display notification easily via a blade command.## Installation
```sh
composer require genealabs/laravel-messenger
```Nothing else needs to be done, as the service provider and facades will be auto-loaded.
## Configuration
If you need to make changes to the default configuration, run the following
command to publish the configuration file `config\genealabs-laravel-messenger.php`:
```sh
php artisan messenger:publish --config
```After that you can configure the configuration according to your needs:
```php
/*
|--------------------------------------------------------------------------
| CSS Framework Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the CSS framework to be used by Messenger for
| Laravel. This allows you to switch or upgrade frameworks without
| having to recreate all your alerts.
|
| Available Settings: "bootstrap3", "bootstrap4"
|
*/'framework' => 'bootstrap4',
/*
|--------------------------------------------------------------------------
| JavaScript Blade Section
|--------------------------------------------------------------------------
|
| Your layout blade template will need to have a section dedicated to
| inline JavaScript methods and commands that are injected by this
| package. This will eliminate conflicts with Vue, as well as
| making sure that JS is run after all deps are loaded.
|
*/'javascript-blade-section' => 'js',
```## Usage
1. Trigger an alert using either the facade/IoC helper, or a blade directive
in another view:
```php
// IoC helper:
app('messenger')->send('message', 'title', 'level', autoHide, 'framework');// Facade:
Messenger::send('message', 'title', 'level', autoHide, 'framework');// Blade directive:
@send ('message', 'title', 'level', autoHide, 'framework')
```
2. Add the placeholder to your layout blade file:
```php
@deliver
```### Parameters
#### **message**
_string|required_The body of the message you want to deliver to your user. This may contain
HTML. If you add links, be sure to add the appropriate classes for the
framework you are using.#### **title**
_string | optional | default: ''_Title of the notification, will be inserted as an `
` tag, can also include
HTML. Again, keep in mind to add any framework-specific formatting yourself.#### **level**
_string | optional | default: 'info'_If provided, must be one of the following: 'info', 'success', 'warning',
'danger'.#### **autoHide**
_boolean | optional | default: false_Allows you to let the notification disappear automatically after 15 seconds. If
autoHide is false, the user will be provided a close button in the alert.#### **framework**
_string | optional | default: 'bootstrap3'_Specify the framework you are using. Right now it only supports 'bootstrap3'
or 'bootstrap4'.
#### **type**
_string | optional | default: 'alert'_Invoke any of the available alert modes. Currently only supports 'alert' or
'modal'.