Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
edoriansyah committed Jun 4, 2016
0 parents commit 49d6ae2
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Alert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
namespace edoriansyah\alert;
use Yii;
class Alert extends \yii\bootstrap\Widget
{
public function init()
{
parent::init();
if(Yii::$app->session->hasFlash('success')){
echo '<div class="alert alert-success">';
echo Yii::$app->session->getFlash('success');
echo '</div>';
}else if (Yii::$app->session->hasFlash('error')){
echo '<div class="alert alert-danger">';
echo Yii::$app->session->getFlash('error');
echo '</div>';
}
}
}
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
yii2-alert-nf
=============
Widget Alert twitter bootstrap for Yii Framework 2

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist edoriansyah/yii2-alert-nf "*"
```

or add

```
"edoriansyah/yii2-alert-nf": "*"
```

to the require section of your `composer.json` file.


Usage
-----

Once the extension is installed, simply use it in your code by :

```php
<?= \edoriansyah\alert\AutoloadExample::widget(); ?>```
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "edoriansyah/yii2-alert-nf",
"description": "Widget Alert twitter bootstrap for Yii Framework 2",
"type": "yii2-extension",
"keywords": ["yii2","extension","alert"],
"license": "MIT",
"authors": [
{
"name": "Edo Riansyah",
"email": "[email protected]"
}
],
"require": {
"yiisoft/yii2": "*"
},
"autoload": {
"psr-4": {
"edoriansyah\\alert\\": ""
}
}
}

0 comments on commit 49d6ae2

Please sign in to comment.