PHPackages                             autoxloo/apns - 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. autoxloo/apns

ActiveLibrary

autoxloo/apns
=============

Apple Notification Server

1.0.0(6y ago)01201BSD-3-ClausePHPPHP &gt;=5.5.0

Since May 7Pushed 4y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

Apple Notification Server
=========================

[](#apple-notification-server)

Sends push notification via Apple Notification Server

> Note: This package is not supported properly

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist autoxloo/apns "*"

```

or

```
composer require --prefer-dist autoxloo/apns "*"
```

or add

```
"autoxloo/apns": "*"

```

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

Configuration
-------------

[](#configuration)

You have to install curl with http2 support:

```
cd ~
sudo apt-get install build-essential nghttp2 libnghttp2-dev libssl-dev
wget https://curl.haxx.se/download/curl-7.58.0.tar.gz
tar -xvf curl-7.58.0.tar.gz
cd curl-7.58.0
./configure --with-nghttp2 --prefix=/usr/local --with-ssl=/usr/local/ssl
make
sudo make install
sudo ldconfig
sudo reboot

```

Info from

If not helped, try

Usage
-----

[](#usage)

To send push notification you should have apple .pem certificate.

Constructor params and default values:

```
use autoxloo\apns\AppleNotificationServer;

$appleCertPath = __DIR__ . '/wxv_cert.pem';

$apns = new AppleNotificationServer(
    $appleCertPath,
    $apiUrl = 'https://api.push.apple.com/3/device',
    $apiUrlDev = 'https://api.sandbox.push.apple.com/3/device',
    $apnsPort = 443,
    $pushTimeOut = 10,
    $topic = null,
    $expiration = null,
    $pushType = null
);
```

Sending push notification:

```
use autoxloo\apns\AppleNotificationServer;

$appleCertPath = __DIR__ . '/wxv_cert.pem';
$token = 'some device token';
$payload = [
    'some key1' => 'some value1',
    'some key2' => 'some value2',
];

$apns = new AppleNotificationServer($appleCertPath);
$response = $apns->send($token, $payload);
```

or if you want to send to many tokens:

```
use autoxloo\apns\AppleNotificationServer;

$appleCertPath = __DIR__ . '/wxv_cert.pem';
$tokens = [
    'some device token',
    'some other device token',
];
$payload = [
    'some key1' => 'some value1',
    'some key2' => 'some value2',
];

$apns = new AppleNotificationServer($appleCertPath);
$response = $apns->sendToMany($tokens, $payload);
```

If you want to send push notification with some `apns-push-type`, you need certificate compilable with this push type and to set `AppleNotificationServer::$pushType` in constructor or with set method:

```
use autoxloo\apns\AppleNotificationServer;

$appleCertPath = __DIR__ . '/wxv_cert.pem';
$token = 'some device token';
$payload = [
    'some key1' => 'some value1',
    'some key2' => 'some value2',
];

$apns = new AppleNotificationServer($appleCertPath);
$apns->setPushType(AppleNotificationServer::PUSH_TYPE_BACKGROUND);  // sets `apns-push-type` header.
// other available set methods:
$apns->setTopic('some topic');  // sets `apns-topic` header.
$apns->setExpiration(time() + 30);  // sets `apns-expiration` header.
$apns->setExpiration(0);  // sets `apns-expiration` header. If the value is 0, APNs attempts to deliver
                          // the notification only once and doesn’t store it.
$response = $apns->send($token, $payload);
```

`AppleNotificationServer` sends push notification first on `$apiUrl` () if not success (not status code `200`), then sends on `$apiUrlDev` (). If you don't want to send push notification on `$apiUrlDev` set it value to `false`. Also, if you want to send push notification only on dev url, you can do so like this (set `$apiUrl` with dev url value):

```
use autoxloo\apns\AppleNotificationServer;

$apns = new AppleNotificationServer($appleCertPath, 'https://api.sandbox.apple.com/3/device', false);
```

See [Generating a Remote Notification](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification)and [Sending Notification Requests to APNs](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns)for more details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2194d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e0af05c82328c2e95f5808024281b4f3779bed0a7abb450943973f1f6388472?d=identicon)[autoxloo](/maintainers/autoxloo)

---

Top Contributors

[![VasylDmytruk](https://avatars.githubusercontent.com/u/32508794?v=4)](https://github.com/VasylDmytruk "VasylDmytruk (48 commits)")

### Embed Badge

![Health badge](/badges/autoxloo-apns/health.svg)

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

PHPackages © 2026

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