Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
loveorigami committed Mar 21, 2016
1 parent e37347b commit ee67611
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 LoveOrigami

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 73 additions & 0 deletions README.md
@@ -0,0 +1,73 @@
# Getting started with yii2-notification-wrapper

Yii2-notification-wrapper module renders a message from session flash (with ajax support). All flash messages are displayed
in the sequence they were assigned using setFlash. You can set message as following:

```php
public function actionIndex(){
...
\Yii::$app->getSession()->setFlash('error', 'noty1');
\Yii::$app->getSession()->setFlash('info', 'noty2');
\Yii::$app->getSession()->setFlash('success', 'noty3');
\Yii::$app->getSession()->setFlash('warning', 'noty4');
...
return $this->render('index');
}
// or in ajax action

public function actionAjax(){
...
\Yii::$app->getSession()->setFlash('error', 'ajax-noty1');
\Yii::$app->getSession()->setFlash('info', 'ajax-noty2');
\Yii::$app->getSession()->setFlash('success', 'ajax-noty3');
\Yii::$app->getSession()->setFlash('warning', 'ajax-noty4');
...
$data = 'Some data to be returned in response to ajax request';
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
return $data;
}
```

Download
--------

Yii2-notification-wrapper can be installed using composer. Run following command to download and
install Yii2-notification-wrapper:

```bash
composer require "loveorigami/yii2-notification-wrapper": "*"
```

Configure application
---------------------

Let's start with defining module in our config file (`@common/config/main.php`):

```php
'modules' => [
'noty' => [
'class' => 'lo\modules\noty\Module',
],
],
```
That's all, now you have module installed and configured.

Usage
-----


Supported libraries
-------------------

Currently supported libraries are:

| Library | Constant | Project homepage |
| -------------- | ------------- | ---------------------------------------------- |
| Noty | THEME_NOTY | https://github.com/Shifrin/yii2-noty |
| Toastr | THEME_TOASTR | https://github.com/lavrentiev/yii2-toastr |


## License

Yii2-plugins-system is released under the MIT License. See the bundled [LICENSE.md](LICENSE.md)
for details.

0 comments on commit ee67611

Please sign in to comment.