Coder Social home page Coder Social logo

amaran-laravel's Introduction

AmaranJS Laravel 5 Package

Laravel Source License

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

Installation

Begin by installing the package through Composer. You can add your composer.json require section:

"xuma/laravel-amaran": "1.1.0"

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:

Service Provider

Xuma\Amaran\AmaranServiceProvider::class,

Facade

'Amaran' => Xuma\Amaran\Facades\Amaran::class,

Installing AmaranJS jQuery Plugin

You can choose to install AmaranJS manually or you can publish assets.

If you choose install manually, extract your AmaranJS files to public/ directory. You can find installation documentation of AmaranJS here.

You can publish assets with below command and assets will be placed in /css, /js folders.

php artisan vendor:publish --provider="Xuma\Amaran\AmaranServiceProvider" --tag="assets"

Default configuration.

If you want to use same configuration by default you can use configuration file. You can publish configuration file with below command.

php artisan vendor:publish --provider="Xuma\Amaran\AmaranServiceProvider" --tag="config"

Adding Output View

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

Usage is very simple.If you want to use default theme;

Amaran::content(['message'=>'Hello World!'])->create();

Using AmaranJS Functions

You can use most AmaranJS functions as methods like :

Amaran::content([ 'message'=>'Hello World!'])
    ->position('top right')
    ->inEffect('slideRight')
    ->outEffect('slideBottom')
    ->sticky(true)
    ->create();

Binding Javascript Events to Element

You can define javascript events with bind() method

Amaran::content(['message'=>'Hello World!'])
    ->position('top right')
    ->bind('#start','click')
  - >create();

Using as Flash Message

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

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.