AmaranJS L5 package is a Laravel wrapper for my jquery plugin AmaranJS.You can create easy and stylish notifications with AmaranJS.
Package Demo: http://ersu.me/laravel-amaranjs
Begin by installing the package through Composer. You can add your composer.json require section:
"xuma/laravel-amaran": "~1.0@dev"
Don't forget to update composer update
.
Once this operation is complete, simply add both the service provider and facade classes to your project's config/app.php
file:
'Xuma\Amaran\AmaranServiceProvider'
'Amaran' => 'Xuma\Amaran\Facades\Amaran'
Before starting download and extract your AmaranJS files to public/ directory and add necessary plugin files to your view.You can find installation documentation of AmaranJS here.
Add required view after your jQuery and AmaranJS links.
@include('amaran::javascript')
Example:
<script src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.js"></script>
<script src="js/jquery.amaran.js"></script>
@include('amaran::javascript')
Usage is very simple.If you want to use default theme;
Amaran::content(['message'=>'Hello World!'])->create();
You can use most AmaranJS functions as methods like :
Amaran::content([ 'message'=>'Hello World!'])
->position('top right')
->inEffect('slideRight')
->outEffect('slideBottom')
->sticky(true)
->create();
You can define javascript events with bind()
method
Amaran::content(['message'=>'Hello World!'])
->position('top right')
->bind('#start','click')
- >create();
Normally AmaranJS bind to current view but you can add ->flash()
method for bind to redirected methods view.
Amaran::content(['message'=>'Hello World'])->flash()->create();
Theme usage is simple just set theme name and set content as theme template array.
Amaran::theme('awesome ok')->content([
'title'=>'My first funcy example!',
'message'=>'1.4 GB',
'info'=>'my_birthday.mp4',
'icon'=>'fa fa-download'
])->create();
Little note if you want to use awesome theme you have to include font awesome.