PHPackages                             issetbv/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. issetbv/push-notification

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

issetbv/push-notification
=========================

PushNotification is a push message abstraction which allows you to easily send push notifications to mobile devices. Currently we support Apple, Android and Windows (experimental)

1.2.0(9y ago)16.0k11MITPHPPHP &gt;=7.0

Since Mar 8Pushed 9y ago4 watchersCompare

[ Source](https://github.com/Isset/pushnotification)[ Packagist](https://packagist.org/packages/issetbv/push-notification)[ Docs](http://www.isset.nl)[ RSS](/packages/issetbv-push-notification/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (6)Versions (11)Used By (1)

IssetBV/PushNotification
========================

[](#issetbvpushnotification)

[![Build Status](https://camo.githubusercontent.com/c0c884af54db4953587956762f53f0a1b059d625d7a5a30a5e7032128ebdb026/68747470733a2f2f7472617669732d63692e6f72672f49737365742f707573686e6f74696669636174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Isset/pushnotification)[![Coverage Status](https://camo.githubusercontent.com/8e6e6fe765edde6f0293901e7bf27ef6350bf592e898284b1293c44389bb7c2a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f49737365742f707573686e6f74696669636174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/Isset/pushnotification?branch=master)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![PHPStan](https://camo.githubusercontent.com/441b5874ce4df0a2defc892979c96c46889b69cb32119d04f0b48626349f8bc9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/phpstan/phpstan)

PushNotification is a push message abstraction which allows you to easily send push notifications to mobile devices. Currently we support Apple, Android and Windows (experimental)

Why Yet Another Notification Package
------------------------------------

[](#why-yet-another-notification-package)

- There are many packages out there that support mobile push notification, but most do not support an unified API.
- Some implementations were lacking flexible logging capabilities
- Most implementations did not support batches/queues
- Most implementations did not take into account that when sending batches to Apple, if one of the messages fails, the entire batch is dropped. This means that if you have a queue of 50 messages and the 3rd message fails, 47 messages will be dropped. This frustrated us to no end, so we build a simple yet effective fallback mechanism that will restart the batch from the first message after the failed one.

Goals
-----

[](#goals)

- Have a generic API for sending push notifications regardless of device.
- Have consistent output.
- Integrate well with other packages/frameworks.
- Have a flexible logging mechanism.
- Have build in queue mechanism.
- Have build in queue resume when dealing with batches (specifically sent to Apple).

Prerequisites
-------------

[](#prerequisites)

- PHP 7.0+
- [cURL](https://secure.php.net/manual/en/book.curl.php)

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

[](#installation)

Through Composer:

```
  composer require issetbv/push-notification
```

Integrations
------------

[](#integrations)

At the moment we only support Symfony, since that's what we use, but feel free to create your own, and send us a PR with a link to your integration

- Symfony integration:

Supported Devices
-----------------

[](#supported-devices)

- Android
- Apple
- Windows (experimental)

Documentation
-------------

[](#documentation)

The bulk of the documentation is stored in the docs/index.md file in this package:

[Read the Documentation](docs/index.md)

If you just want to send a message without using the `NotificationCenter` here are some simple `TL;DR` examples

### Simple Android Example

[](#simple-android-example)

To send a push notification to an Android device we first need to setup a connection. A connection needs a `name`, `api url` and your `api key`. Lastly we need the device token of the device we want to send the message to.

```
    use IssetBV\PushNotification\Type\Android\AndroidConnection;
    use IssetBV\PushNotification\Type\Android\Message\AndroidMessage;

    $connection = new AndroidConnection(
        $name,    // 'android'
        $api_url, // 'https://fcm.googleapis.com/fcm/send'
        $api_key, // 'super-secret-api-key
    );

    $message = new AndroidMessage('my-device-token');
    $message->addToPayload('notification', ['title' => 'Test android']);

    $response = $connection->sendAndReceive($message);

    echo $response->isSuccess(); // should be true
```

### Simple Apple Example

[](#simple-apple-example)

To send a push notification to an Apple device we first need to setup a connection. A connection needs a `name`, `api url`, location of the `pem file` and the passphrase of the `pem` file (if the `pem` file has one). Lastly we need the device identifier of the device we want to send the message to.

```
    use IssetBV\PushNotification\Type\Apple\AppleConnection;
    use IssetBV\PushNotification\Type\Apple\Message\AppleMessageAps;

    $connection = new AppleConnection(
        $name,      // 'apple'
        $api_url,   // 'ssl://gateway.push.apple.com:2195'
        $pemFile,   // __DIR__ '/pemfile.pem'
        $passPhrase // 'super-secret-passphrase'
    );

    $appleMessage = new AppleMessageAps('my-device-identifier');
    // see notes below as to why we don't use ->addToPayload()
    $appleMessage->getAps()->setAlert('Test apple');

    $response = $connection->sendAndReceive($appleMessage);

    echo $response->isSuccess(); // should be true
```

When sending messages to Apple, the payload can have a specific key named `aps` where we can specify that it should show a notification on the screen. For more information, visit the [official Apple documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html) regarding the message format.

### Simple Windows Example

[](#simple-windows-example)

To send a push notification to a Windows device we first need to setup a connection. A connection only needs a `name`. Differently than with Android or Apple, the Windows message needs the uri of your specific device to deliver the message.

```
    use IssetBV\PushNotification\Type\Windows\Message\WindowsMessage;
    use IssetBV\PushNotification\Type\Windows\WindowsConnection;

    $connection = new WindowsConnection('windows');

    $windowsMessage = new WindowsMessage('https://cloud.notify.windows.com/?token=AQE%bU%2fSjZOCvRjjpILow%3d%3d');
    $windowsMessage->addToPayload('wp:Text1', 'Test Windows');

    $response = $connection->sendAndReceive($windowsMessage);

    echo $response->isSuccess(); // should be true
```

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 54.5% 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 ~4 days

Total

7

Last Release

3372d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cc2496b3830171f38ba41453bc043026aa9f7a9ef1e6a44a93ec22e0c09c793?d=identicon)[IssetBV](/maintainers/IssetBV)

---

Top Contributors

[![jeroenvdgulik](https://avatars.githubusercontent.com/u/242090?v=4)](https://github.com/jeroenvdgulik "jeroenvdgulik (6 commits)")[![fhjbalfoort](https://avatars.githubusercontent.com/u/1055903?v=4)](https://github.com/fhjbalfoort "fhjbalfoort (5 commits)")

---

Tags

pushnotificationsmobileapplewindowsandroidioswindowsphonepush notificationspush messages

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[minishlink/web-push

Web Push library for PHP

1.9k13.4M70](/packages/minishlink-web-push)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[bentools/webpush-bundle

Send push notifications through Web Push Protocol to your Symfony users.

72285.7k](/packages/bentools-webpush-bundle)[paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

1961.3M11](/packages/paragraph1-php-fcm)[ivkos/pushbullet

Push notifications to devices and browsers via Pushbullet

21863.0k2](/packages/ivkos-pushbullet)[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

37858.2k2](/packages/redjanym-php-firebase-cloud-messaging)

PHPackages © 2026

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