PHPackages                             alxmsl/apnsclient - 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. alxmsl/apnsclient

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

alxmsl/apnsclient
=================

Client for Apple Push Notification Service (APNS)

v2.0.2(11y ago)11256WTFPLPHP

Since Sep 12Pushed 7y ago3 watchersCompare

[ Source](https://github.com/alxmsl/APNSClient)[ Packagist](https://packagist.org/packages/alxmsl/apnsclient)[ RSS](/packages/alxmsl-apnsclient/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (10)Used By (0)

APNSClient
==========

[](#apnsclient)

Client for Apple Push Notification Service (APNS)

Standard payload creation
-------------------------

[](#standard-payload-creation)

```
// Create simple alert item
$SimpleItem = new \APNS\Notification\AlertItem();
$SimpleItem->setBody('просто уведомление');

// Create simple payload
$SimplePayload = new \APNS\Notification\BasePayload();
$SimplePayload->setAlertItem($SimpleItem);

// Look at simple payload
var_dump((string) $SimplePayload);

```

Localized payload creation
--------------------------

[](#localized-payload-creation)

```
// Create localized alert item
$LocalizedItem = new \APNS\Notification\AlertItem();
$LocalizedItem->setLocalizedKey('GAME_PLAY_REQUEST_FORMAT')
    ->setLocalizedArgs(array(
        'Jenna',
        'Frank',
    ));

// Create localized payload
$LocalizedPayload = new \APNS\Notification\BasePayload();
$LocalizedPayload->setAlertItem($LocalizedItem);

// Look at localized payload
var_dump((string) $LocalizedPayload);

```

Custom payload creation
-----------------------

[](#custom-payload-creation)

```
// Create custom payload class
final class CustomPayload extends \APNS\Notification\BasePayload {
    /**
     * @var null|string custom field
     */
    private $acme = null;

    /**
     * @param string|null $acme custom parameter value if needed
     * @return CustomPayload self
     */
    public function setAcme($acme) {
        $this->acme = (string) $acme;
        return $this;
    }

    /**
     * @return null|string custom parameter if set
     */
    public function getAcme() {
        return $this->acme;
    }

    /**
     * JsonSerializable implementation
     * @return array payload json serializable instance
     */
    public function jsonSerialize() {
        $result = parent::jsonSerialize();

        if (!is_null($this->getAcme())) {
            $result['acme'] = (string) $this->getAcme();
        }
        return $result;
    }
}

// Create simple alert item
$SimpleItem = new \APNS\Notification\AlertItem();
$SimpleItem->setBody('You got your emails.');

// Create payload instance
$CustomPayload = new CustomPayload();
$CustomPayload->setAcme('foo')
    ->setAlertItem($SimpleItem)
    ->setBadgeNumber(9)
    ->setSoundFile('bingbong.aiff');

// Look at payload
var_dump((string) $CustomPayload);

```

Send notification
-----------------

[](#send-notification)

```
// Create APNS notification client
$Client = new \APNS\Notification\Client();

// Set secure certificate filename
$Client->setCertificateFile('certificate.production.pem');

// Create needed alert item
$Item = new \APNS\Notification\AlertItem();
$Item->setBody('test1');

// Create payload
$Payload = new \APNS\Notification\BasePayload();
$Payload->setAlertItem($Item)
    ->setBadgeNumber(1)
    ->setIdentifier(time());

// Send notification to the device
$result = $Client->send('c0RreCtT0kEN', $Payload);
var_dump($result);

```

Use the feedback service
------------------------

[](#use-the-feedback-service)

```
// Create APNS notification client
$Client = new \APNS\Feedback\Client();

// Set secure certificate filename
$Client->setCertificateFile('certificate.production.pem')
    ->setProtocolSchemeSSL();

$Client->process(function ($time, $token) {
    echo date('Y-m-d H:i:s', $time) . ' - ' . $token . "\n";
    return true;
}, false);

var_dump(
    $Client->getReadCount(),
    $Client->getProcessedCount(),
    $Client->getUnprocessedCount(),
    $Client->getErrorCount()
);

```

License
-------

[](#license)

Copyright © 2014 Alexey Maslov This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 96.6% 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 ~30 days

Recently: every ~16 days

Total

8

Last Release

4051d ago

Major Versions

v1.1.1 → v2.0.02015-02-08

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/950057?v=4)[Alexey Maslov](/maintainers/alxmsl)[@alxmsl](https://github.com/alxmsl)

---

Top Contributors

[![alxmsl](https://avatars.githubusercontent.com/u/950057?v=4)](https://github.com/alxmsl "alxmsl (28 commits)")[![dec5e](https://avatars.githubusercontent.com/u/140601?v=4)](https://github.com/dec5e "dec5e (1 commits)")

---

Tags

pushnotificationappleapns

### Embed Badge

![Health badge](/badges/alxmsl-apnsclient/health.svg)

```
[![Health](https://phpackages.com/badges/alxmsl-apnsclient/health.svg)](https://phpackages.com/packages/alxmsl-apnsclient)
```

###  Alternatives

[duccio/apns-php

Apple Push Notification &amp; Feedback Provider

1.4k2.5M13](/packages/duccio-apns-php)[sly/notification-pusher

Standalone PHP library for easy devices notifications push.

1.2k2.8M15](/packages/sly-notification-pusher)[m2mobi/apns-php

Apple Push Notification &amp; Feedback Provider

1118.2k1](/packages/m2mobi-apns-php)

PHPackages © 2026

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