Yii2 Wearesho Notifications Repository

Build Status codecov

This library helps to configure Wearesho Notifications Repository in Yii2 application.

It contains:

  • Bootstrap
  • Job for yii2-queue for async notification pushing

Installation

composer require wearesho-team/yii2-wearesho-notifications-repository

Usage

Put Bootstrap to the bootstrap section in your application's config

<?php

// config/main.php

return [
    'id' => '...',
    'basePath' => '...',
    'bootstrap' => [
        'notifications' => [
            'class' => Wearesho\Notifications\Yii\Bootstrap::class,
        ],
    ],
];

Executing pushing notification in background

<?php

/** @var Wearesho\Notifications\Notification $notification */

Yii::$app->queue->push(
    new Wearesho\Notifications\Yii\PushNotificationJob([
        'notification' => $notification,
    ])
);