PHPackages                             bryglen/yii2-apns-gcm - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. bryglen/yii2-apns-gcm

ActiveYii2-extension[HTTP &amp; Networking](/categories/http)

bryglen/yii2-apns-gcm
=====================

Yii 2 Apns and Gcm together

1.0.5(9y ago)54277.8k↓30.7%38[4 issues](https://github.com/bryglen/yii2-apns-gcm/issues)[2 PRs](https://github.com/bryglen/yii2-apns-gcm/pulls)1MITPHP

Since Feb 19Pushed 5y ago10 watchersCompare

[ Source](https://github.com/bryglen/yii2-apns-gcm)[ Packagist](https://packagist.org/packages/bryglen/yii2-apns-gcm)[ RSS](/packages/bryglen-yii2-apns-gcm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (7)Used By (1)

Yii 2 Apns Gcm
==============

[](#yii-2-apns-gcm)

Yii 2 use Apns and Gcm together with common methods like `send()` and `sendMulti()`

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist bryglen/yii2-apns-gcm "1.0.5"

```

or add

```
"bryglen/yii2-apns-gcm": "1.0.5"

```

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

---

in your main.php your configuration would look like this

```
'components' => [
	'apns' => [
		'class' => 'bryglen\apnsgcm\Apns',
		'environment' => \bryglen\apnsgcm\Apns::ENVIRONMENT_SANDBOX,
		'pemFile' => dirname(__FILE__).'/apnssert/apns-dev.pem',
		// 'retryTimes' => 3,
		'options' => [
			'sendRetryTimes' => 5
		]
	],
	'gcm' => [
		'class' => 'bryglen\apnsgcm\Gcm',
		'apiKey' => 'your_api_key',
	],
	// using both gcm and apns, make sure you have 'gcm' and 'apns' in your component
	'apnsGcm' => [
		'class' => 'bryglen\apnsgcm\ApnsGcm',
		// custom name for the component, by default we will use 'gcm' and 'apns'
		//'gcm' => 'gcm',
		//'apns' => 'apns',
	]
]
```

Online Tester
-------------

[](#online-tester)

Please visit the link for online tester

Usage
-----

[](#usage)

**Usage using APNS only**

```
/* @var $apnsGcm \bryglen\apnsgcm\Apns */
$apns = Yii::$app->apns;
$apns->send($push_tokens, $message,
  [
    'customProperty_1' => 'Hello',
    'customProperty_2' => 'World'
  ],
  [
    'sound' => 'default',
    'badge' => 1
  ]
);
```

**Usage using GCM only**

```
/* @var $apnsGcm \bryglen\apnsgcm\Gcm */
$gcm = Yii::$app->gcm;
$gcm->send($push_tokens, $message,
  [
    'customerProperty' => 1,
  ],
  [
    'timeToLive' => 3
  ],
);
```

### Usage using APNS and GCM Together

[](#usage-using-apns-and-gcm-together)

**Send using Google Cloud Messaging**

```
/* @var $apnsGcm \bryglen\apnsgcm\ApnsGcm */
$apnsGcm = Yii::$app->apnsGcm;
$apnsGcm->send(\bryglen\apnsgcm\ApnsGcm::TYPE_GCM, $push_tokens, $message,
  [
    'customerProperty' => 1
  ],
  [
    'timeToLive' => 3
  ],
)
```

**Send using Apple push notification service**

```
/* @var $apnsGcm \bryglen\apnsgcm\ApnsGcm */
$apnsGcm = Yii::$app->apnsGcm;
$apnsGcm->send(\bryglen\apnsgcm\ApnsGcm::TYPE_APNS, $push_tokens, $message,
  [
    'customerProperty' => 1
  ],
  [
    'sound' => 'default',
  	'badge' => 1
  ],
)
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 72.2% 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 ~159 days

Recently: every ~195 days

Total

6

Last Release

3310d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/875604?v=4)[bryglen](/maintainers/bryglen)[@bryglen](https://github.com/bryglen)

---

Top Contributors

[![bryglen](https://avatars.githubusercontent.com/u/875604?v=4)](https://github.com/bryglen "bryglen (26 commits)")[![Valentinlazy](https://avatars.githubusercontent.com/u/1050995?v=4)](https://github.com/Valentinlazy "Valentinlazy (4 commits)")[![jinujd](https://avatars.githubusercontent.com/u/2300720?v=4)](https://github.com/jinujd "jinujd (2 commits)")[![g-mirgorod-md](https://avatars.githubusercontent.com/u/45852111?v=4)](https://github.com/g-mirgorod-md "g-mirgorod-md (1 commits)")[![Shamil-R](https://avatars.githubusercontent.com/u/8791201?v=4)](https://github.com/Shamil-R "Shamil-R (1 commits)")[![Dumra](https://avatars.githubusercontent.com/u/10818266?v=4)](https://github.com/Dumra "Dumra (1 commits)")[![vitaliykoziy](https://avatars.githubusercontent.com/u/1904996?v=4)](https://github.com/vitaliykoziy "vitaliykoziy (1 commits)")

---

Tags

gcmyii2extensionapns

### Embed Badge

![Health badge](/badges/bryglen-yii2-apns-gcm/health.svg)

```
[![Health](https://phpackages.com/badges/bryglen-yii2-apns-gcm/health.svg)](https://phpackages.com/packages/bryglen-yii2-apns-gcm)
```

###  Alternatives

[linslin/yii2-curl

Easy and nice cURL extension with RESTful support for Yii2

1811.5M20](/packages/linslin-yii2-curl)[hiqdev/yii2-hiart

ActiveRecord for API

5951.8k3](/packages/hiqdev-yii2-hiart)[joni-jones/yii2-wschat

Online chat based on web sockets and ratchet php

981.3k](/packages/joni-jones-yii2-wschat)[yiiplus/yii2-websocket

使用yii2封装 websocket 扩展

212.6k](/packages/yiiplus-yii2-websocket)[afinogen89/get-mail

Get Mail from POP3

116.8k](/packages/afinogen89-get-mail)

PHPackages © 2026

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