Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 80 lines (58 sloc) 2.41 KB


If you want to use notifyii with roles, extensions like "rights" or RBAC are required.

Be shure to have the same 'db' configuratiion in these files:

To install notifyii, navigate to the forlder "protected/modules" of your project. If your project does not have any "modules" folder, just create id. Then, run the command:

$ git clone

Now you just need to add module to confi file:


And try to load these routes:


The first one show you a sample page that create a sample notification. The second one show you a crud to alter notifications.

If you want you can add these items to views/layouts/main.php file:

array('label'=>'Notifyii', 'url'=>array('/notifyii')),
array('label'=>'ModelNotifyii', 'url'=>array('/notifyii/modelNotifyii')),
array('label'=>'NotifyiiReads', 'url'=>array('/notifyii/notifyiiReads')),

Run migrations

/var/www/YOUR_APP_NAME/protected$ ./yiic migrate --migrationPath=webroot.modules.notifyii.migrations

Notify the end of the world

$notifyii = new Notifyii();
$notifyii->title('News from Mayans!');
$notifyii->message('The end of the world');
$notifyii->expire(new DateTime("21-12-2012"));
$notifyii->from("-1 week");
$notifyii->to("+1 day");

Get all notifications



Suppose to load all notifications in your controller:

public function actionIndex()
    $this->render('index', array(
        'notifiche' => ModelNotifyii::getAllNotifications()

In the view, you can load all notifications

<?php $number = 1; ?>
<?php while (Yii::app()->user->hasFlash('success' . ($number))) : ?>
    <?php $message = Yii::app()->user->getFlash('success' . ($number)); ?>
    <div class="flash-success info">
        <h3><?php echo $message['title']; ?></h3>
        <div><?php echo $message['message']; ?></div>
    <?php $number = $number + 1; ?>
<?php endwhile; ?>
Something went wrong with that request. Please try again.