PHPackages                             sasa-b/apns2 - 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. sasa-b/apns2

ActiveLibrary[HTTP &amp; Networking](/categories/http)

sasa-b/apns2
============

APNS - Apple Push Notification Service PHP client

3.0.0(2y ago)2207MITPHPPHP &gt;=8.2

Since Sep 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sasa-b/apns)[ Packagist](https://packagist.org/packages/sasa-b/apns2)[ RSS](/packages/sasa-b-apns2/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (4)Versions (14)Used By (0)

apns
====

[](#apns)

APNS - Apple Push Notification Service PHP Client

[![PHP >= 7.0](https://camo.githubusercontent.com/90eed33e7df559b70b174e97d37a4907946803c7ab691640166d2518d8cd2118/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e302d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![](https://camo.githubusercontent.com/9dfa164697fc397aa375ab2eb9b7324b2898cb3909d90ec9cf1e514479ee2781/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736173612d622f61706e7332)](https://camo.githubusercontent.com/9dfa164697fc397aa375ab2eb9b7324b2898cb3909d90ec9cf1e514479ee2781/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736173612d622f61706e7332)[![](https://camo.githubusercontent.com/a79eefd5f12c676250b30d77fa834c13f1c13d5a7e1ad43540d3592c5ce2a753/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736173612d622f61706e7332)](https://camo.githubusercontent.com/a79eefd5f12c676250b30d77fa834c13f1c13d5a7e1ad43540d3592c5ce2a753/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736173612d622f61706e7332)

Requirements
------------

[](#requirements)

```
PHP >= 7.0
lib-curl >= 7.46.0 (with http/2 support enabled)
lib-openssl >= 1.0.2e

```

In case of PHP 7.0 you will need to compile PHP from source with the newer lib-curl which supports HTTP2 requests:

```
./configure --with-curl=/usr/local/include/curl --with-libdir=lib64 --with-openssl ...

./make

```

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

[](#installation)

```
composer require sasa-b/apns2

```

Getting Started
---------------

[](#getting-started)

### Certificate Provider Trust

[](#certificate-provider-trust)

```
require '/vendor/autoload.php';

use SasaB\Apns\Client;
use SasaB\Apns\Provider\Certificate;

use SasaB\Apns\Payload\Aps;
use SasaB\Apns\Payload\Alert;
use SasaB\Apns\Notification;

$certificate = Certificate::fromFile('/PushCert.pem');

$client = Client::auth($certificate);

$notification = new Notification("{device_token}");

$notification->setAps(new Aps(new Alert('Hello World')));

$response = $client->send($notification);

echo (string) $response->getApnsId()."\n";
echo $response;
```

### Token Key Provider Trust

[](#token-key-provider-trust)

```
require '/vendor/autoload.php';

use SasaB\Apns\Client;
use SasaB\Apns\Provider\JWT;
use SasaB\Apns\Provider\TokenKey;

use SasaB\Apns\Payload\Aps;
use SasaB\Apns\Payload\Alert;
use SasaB\Apns\Notification;

$tokenKey = new TokenKey('{token_key}');
$tokenKey->loadFromFile('/AuthKey.p8');

$jwt = JWT::new('{team_id}', $tokenKey);

if ($jwt->hasExpired()) {
    $jwt->refresh($tokenKey);
}

$client = Client::auth($jwt);

$notification = new Notification("{device_token}");

$notification->setPushTopic('com.vendor.app');

$notification->setAps(new Aps(new Alert('Hello World')));

$response = $client->send($notification);

echo (string) $response->getApnsId()."\n";
echo $response;
```

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity74

Established project with proven stability

 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

Every ~104 days

Recently: every ~284 days

Total

13

Last Release

828d ago

Major Versions

1.0.6 → 2.0.02020-12-21

v1.x-dev → 2.0.12020-12-22

2.0.1 → 3.0.02024-01-31

PHP version history (3 changes)1.0.0PHP &gt;=7.0

2.0.0PHP &gt;=8.0

3.0.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/b69f1d9205d4b96ec1c90ff7bc2503f1d14ea4b0b89b82b406c16f922c634133?d=identicon)[sasa-b](/maintainers/sasa-b)

---

Top Contributors

[![sasa-b](https://avatars.githubusercontent.com/u/18427949?v=4)](https://github.com/sasa-b "sasa-b (12 commits)")

---

Tags

apnsapns2appleclientclient-libraryiosphpphp-7php-libraryphp7push-notificationshttpclienthttp2appleapnsiospush notificationsapns2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sasa-b-apns2/health.svg)

```
[![Health](https://phpackages.com/badges/sasa-b-apns2/health.svg)](https://phpackages.com/packages/sasa-b-apns2)
```

###  Alternatives

[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[swoole/grpc

Grpc PHP Client base on Swoole Http2 Coroutine

19718.9k1](/packages/swoole-grpc)[swoole/etcd-client

Grpc PHP Client base on Swoole Http2 Coroutine

1973.2k1](/packages/swoole-etcd-client)[printu/labelary

PHP API for Labelary.com

34616.9k](/packages/printu-labelary)[printu/customerio

PHP API for Customer.io

241.1M2](/packages/printu-customerio)[8bitov/clickhouse-php-client

6966.6k](/packages/8bitov-clickhouse-php-client)

PHPackages © 2026

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