PHPackages                             develandoo/yii2-push-notification - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. develandoo/yii2-push-notification

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

develandoo/yii2-push-notification
=================================

Yii2 apns/gcm push notification

1.1.1(8y ago)3630.5k↓45%6[2 PRs](https://github.com/Develandoo/yii2-push-notification/pulls)1BSD-3-ClausePHPPHP &gt;=5.4

Since Jan 17Pushed 8y ago12 watchersCompare

[ Source](https://github.com/Develandoo/yii2-push-notification)[ Packagist](https://packagist.org/packages/develandoo/yii2-push-notification)[ Docs](https://github.com/develandoo/yii2-push-notification)[ RSS](/packages/develandoo-yii2-push-notification/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)DependenciesVersions (6)Used By (1)

Yii2 apns/gcm push notification
===============================

[](#yii2-apnsgcm-push-notification)

### INSTALLATION

[](#installation)

Run

```
composer require develandoo/yii2-push-notification

```

or add

```
 "develandoo/yii2-push-notification": "^1.0"

```

### CONFIGURATION

[](#configuration)

*in your main.php your configuration would look like this*

```
    'components' => [
         'push' => [
             'class' => 'develandoo\notification\Push',
             'options' => [
                 'returnInvalidTokens' => true //default false
             ],
             'apnsConfig' => [
                 'environment' => Push::APNS_ENVIRONMENT_PRODUCTION or Push::APNS_ENVIRONMENT_SANDBOX,
                 'pem' => 'PEM_FILE_ABS_URL',
                 'passphrase' => 'YOUR_PASS_PHRASE', //optional
             ],
             'gcmConfig' => [
                 'apiAccessKey' => 'YOUR_GCM_API_KEY'
             ]
         ]
     ]
```

### EXAMPLE

[](#example)

```
$push = Yii::$app->push;

// ios signle token example
$push->ios()->send('token', [
    'custom-key' => 'custom-value',
    'aps' => [
        'alert' => [
            'loc-key' => 'i18n_key',
            'loc-args' => ['arg1'],
        ]
    ],
    'badge' => 1,
    'sound' => 'default'
]);

// ios multiple tokens example
$push->ios()->send(['token1,token2'], [
    'custom-key' => 'custom-value',
    'aps' => [
        'alert' => 'STRING_MESSAGE'
    ],
    'badge' => 1,
    'sound' => 'default'
]);

// android example
$push->android()->send(['token1,token2'], [
    'key' => 'i18n_key',
    'args' => ['arg1'],
    'custom-key'=>'custom-value'
]);

// mixed tokens example
$push->send([
    'ios-tokens1',
    'android-token1',
    'android-token2',
    'ios-token2'
], $payload);

// firebase (both ios and android are supported) multiple tokens example
$push->firebase()->send(['token1','token2'], [
    // Background (closed) application data.
    'notification' => [
        'body' => 'Background application message',
        'title' => 'AppName',
        'sound' => 'default',
    ],
    // Foreground (running) application data.
    'data' => [
        'custom-key' => 'Any custom data could be delivered into foreground application. '
        . 'In order to simulate push notification, this data should be used inside "local notification" by client application.',
    ],
]);
```

### EXCEPTION CASES

[](#exception-cases)

- `Apns environment is invalid.`
- `Apns pem is invalid.`
- `Gcm api access key is invalid.`
- `Gcm in not enabled.`
- `Apns in not enabled.`

© [DEVELANDOO](http://develandoo.com) 2017

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Total

4

Last Release

3013d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20ecbb8ba66e08ea1da4a0fd891c38174a9691a99b1e716fb6b21d436304f258?d=identicon)[dav93](/maintainers/dav93)

---

Top Contributors

[![bit-crafter](https://avatars.githubusercontent.com/u/10452309?v=4)](https://github.com/bit-crafter "bit-crafter (5 commits)")[![nostop8](https://avatars.githubusercontent.com/u/818658?v=4)](https://github.com/nostop8 "nostop8 (2 commits)")

---

Tags

pushnotificationyii2develandoo

### Embed Badge

![Health badge](/badges/develandoo-yii2-push-notification/health.svg)

```
[![Health](https://phpackages.com/badges/develandoo-yii2-push-notification/health.svg)](https://phpackages.com/packages/develandoo-yii2-push-notification)
```

###  Alternatives

[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[loveorigami/yii2-notification-wrapper

This module for renders a message from session flash (with ajax, pjax support and etc.)

77199.7k5](/packages/loveorigami-yii2-notification-wrapper)[mcfedr/awspushbundle

A set of services to simplify using Aws to send push notifications

40378.6k1](/packages/mcfedr-awspushbundle)[ker0x/cakephp-push

CakePHP plugin to send push notification through services like FCM

1815.7k](/packages/ker0x-cakephp-push)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
