├── .gitignore
├── LICENSE
├── README.md
├── composer.json
├── phpunit.xml
├── src
└── Xuma
│ ├── Amaran
│ ├── AmaranHandler.php
│ ├── AmaranServiceProvider.php
│ ├── AmaranViewBinder.php
│ ├── Assets
│ │ ├── amaran.min.css
│ │ └── jquery.amaran.min.js
│ ├── Config
│ │ └── amaran.php
│ ├── Facades
│ │ └── Amaran.php
│ └── ViewBinder.php
│ └── views
│ └── javascript.blade.php
└── travis.yml
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | composer.lock
3 | .idea
4 | .DS_Store
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Hakan ERSU
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | AmaranJS Laravel 5 Package
2 | ==========================
3 | [](http://laravel.com)
4 | [](https://github.com/hakanersu/amaran-laravel)
5 | [](https://tldrlegal.com/license/mit-license)
6 |
7 | [AmaranJS][1] L5 package is a Laravel wrapper for my jquery plugin [AmaranJS][1].You can create easy and stylish notifications with [AmaranJS][1].
8 |
9 | Package Demo: http://ersu.me/laravel-amaranjs
10 |
11 | Installation
12 | ------------
13 | Begin by installing the package through Composer. You can add your composer.json require section:
14 | ```json
15 | "xuma/laravel-amaran": "1.1.0"
16 | ```
17 | Don't forget to update `composer update`.
18 |
19 | Once this operation is complete, simply add both the service provider and facade classes to your project's `config/app.php` file:
20 |
21 | #### Service Provider
22 | ```php
23 | Xuma\Amaran\AmaranServiceProvider::class,
24 | ```
25 | #### Facade
26 | ```php
27 | 'Amaran' => Xuma\Amaran\Facades\Amaran::class,
28 | ```
29 |
30 | #### Installing AmaranJS jQuery Plugin
31 |
32 | You can choose to install AmaranJS manually or you can publish assets.
33 |
34 | If you choose install manually, extract your [AmaranJS][1] files to public/ directory. You can find installation documentation of [AmaranJS][1] [here][1].
35 |
36 | You can publish assets with below command and assets will be placed in /css, /js folders.
37 |
38 | ```php
39 | php artisan vendor:publish --provider="Xuma\Amaran\AmaranServiceProvider" --tag="assets"
40 | ```
41 |
42 | #### Default configuration.
43 |
44 | If you want to use same configuration by default you can use configuration file. You can publish configuration file with below command.
45 |
46 | ```php
47 | php artisan vendor:publish --provider="Xuma\Amaran\AmaranServiceProvider" --tag="config"
48 | ```
49 |
50 | #### Adding Output View
51 |
52 | Add required view after your jQuery and AmaranJS links.
53 |
54 | ```php
55 | @include('amaran::javascript')
56 | ```
57 |
58 | Example:
59 |
60 | ```php
61 |
62 |
63 | @include('amaran::javascript')
64 | ```
65 |
66 | Usage
67 | -----
68 |
69 | Usage is very simple.If you want to use default theme;
70 |
71 | ```php
72 | Amaran::content(['message'=>'Hello World!'])->create();
73 | ```
74 |
75 | #### Using AmaranJS Functions
76 |
77 | You can use most [AmaranJS][1] functions as methods like :
78 |
79 | ```php
80 | Amaran::content([ 'message'=>'Hello World!'])
81 | ->position('top right')
82 | ->inEffect('slideRight')
83 | ->outEffect('slideBottom')
84 | ->sticky(true)
85 | ->create();
86 | ```
87 |
88 | #### Binding Javascript Events to Element
89 | You can define javascript events with `bind()` method
90 | ```php
91 | Amaran::content(['message'=>'Hello World!'])
92 | ->position('top right')
93 | ->bind('#start','click')
94 | - >create();
95 | ```
96 |
97 | #### Using as Flash Message
98 | Normally AmaranJS bind to current view but you can add ```->flash()``` method for bind to redirected methods view.
99 |
100 | ```php
101 | Amaran::content(['message'=>'Hello World'])->flash()->create();
102 | ```
103 |
104 | Theme Usage
105 | -----
106 |
107 | Theme usage is simple just set theme name and set content as theme template array.
108 | ```php
109 | Amaran::theme('awesome ok')->content([
110 | 'title'=>'My first funcy example!',
111 | 'message'=>'1.4 GB',
112 | 'info'=>'my_birthday.mp4',
113 | 'icon'=>'fa fa-download'
114 | ])->create();
115 | ```
116 |
117 | > Little note if you want to use awesome theme you have to include [font awesome][2].
118 |
119 | [1]: https://github.com/hakanersu/AmaranJS
120 | [2]: http://fortawesome.github.io/Font-Awesome/icons/
121 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "xuma/laravel-amaran",
3 | "description": "Laravel 5 Notification",
4 | "keywords": ["stylish", "laravel", "notification"],
5 | "license": "MIT",
6 | "authors": [
7 | {
8 | "name": "Hakan ERSU",
9 | "email": "hakanersu@gmail.com"
10 | }
11 | ],
12 | "require": {
13 | "php": ">=5.4.0"
14 | },
15 | "autoload": {
16 | "psr-0": {
17 | "Xuma\\Amaran": "src/"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
'+t.title+"
"+t.message+''+t.info+"
"},userTheme:function(t){return'