PHPackages                             silverd/laravel-apn-notification-channel - 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. silverd/laravel-apn-notification-channel

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

silverd/laravel-apn-notification-channel
========================================

Apple Push Notification Service (APNs) notifications channel for Laravel 6 using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)

v1.1.0(6y ago)018MITPHPPHP ^7.2

Since Dec 14Pushed 5y agoCompare

[ Source](https://github.com/silverd/laravel-apn-notification-channel)[ Packagist](https://packagist.org/packages/silverd/laravel-apn-notification-channel)[ Docs](https://github.com/semyonchetvertnyh/laravel-apn-notification-channel)[ RSS](/packages/silverd-laravel-apn-notification-channel/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (11)Used By (0)

APNs (.p8) notifications channel for Laravel 6
==============================================

[](#apns-p8-notifications-channel-for-laravel-6)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cbbf749941681c7ade037d99a1341138dff1fe9aa4466695b798bbe08937c4c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696c766572642f6c61726176656c2d61706e2d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/silverd/laravel-apn-notification-channel)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b99b3ecddf47e9415de69c89957014e76c13ca29035bfbde8092e9eb0c86bedc/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73696c766572642f6c61726176656c2d61706e2d6e6f74696669636174696f6e2d6368616e6e656c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/silverd/laravel-apn-notification-channel)[![StyleCI](https://camo.githubusercontent.com/7a2a3cdb07c1b1f483a2ea1e5e08468a507a89b7fb220a4a2d1ee8491f097b4a/68747470733a2f2f7374796c6563692e696f2f7265706f732f3136313730333836362f736869656c64)](https://styleci.io/repos/161703866)[![Quality Score](https://camo.githubusercontent.com/8397b4e311deed9644c9ab5ec10861535de47edbe3b3f4bc02aca23875e1ca99/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73696c766572642f6c61726176656c2d61706e2d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/silverd/laravel-apn-notification-channel)[![Code Coverage](https://camo.githubusercontent.com/e78297007d8244aaab3c35921c7eec8609e65fe77666209ae8e2639fc1d5161f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73696c766572642f6c61726176656c2d61706e2d6e6f74696669636174696f6e2d6368616e6e656c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/silverd/laravel-apn-notification-channel/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/4a80cfd08b80e2d758d9ff7487bbbd1a76d9eb235534d2ed3b5638a5053935ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696c766572642f6c61726176656c2d61706e2d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/silverd/laravel-apn-notification-channel)

This package makes it easy to send notifications with Laravel 6 to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key).

Contents
--------

[](#contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
    - [Setting up the APN service](#setting-up-the-apn-service)
- [Usage](#usage)
    - [Available Message methods](#available-message-methods)
- [TODO](#todo)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Features
--------

[](#features)

- Uses new Apple APNs HTTP/2 connection
- Supports JWT-based authentication
- Supports Certificate-based authentication
- Supports new iOS 10 features such as Collapse IDs, Subtitles and Mutable Notifications
- Uses concurrent requests to APNs
- Tested and working in APNs production environment

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

[](#requirements)

- PHP &gt;= 7.2
- lib-curl &gt;= 7.46.0 (with http/2 support enabled)
- lib-openssl &gt;= 1.0.2e

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

[](#installation)

Install this package with Composer:

```
composer require silverd/laravel-apn-notification-channel
```

If you're installing the package in Laravel 5.4 or lower, you must import the service provider:

```
// config/app.php
'providers' => [
    // ...
    SemyonChetvertnyh\ApnNotificationChannel\ApnServiceProvider::class,
],
```

### Setting up the APN service

[](#setting-up-the-apn-service)

Add the credentials to your `config/broadcasting.php`:

If you are using JWT-based authentication:

```
// config/broadcasting.php
'connections' => [
    ...
    'apn' => [
        'driver' => 'jwt',
        'is_production' => env('APP_ENV') === 'production',
        'key_id' => env('APN_KEY_ID'), // The Key ID of the p8 file (available at https://developer.apple.com/account/ios/authkey/)
        'team_id' => env('APN_TEAM_ID'), // The Team ID of your Apple Developer Account (available at https://developer.apple.com/account/#/membership/)
        'app_bundle_id' => env('APN_APP_BUNDLE_ID'), // The Bundle ID of your application. For example, "com.company.application"
        'private_key_path' => env('APN_PRIVATE_KEY', storage_path('apns-private-key.p8')),
        'private_key_secret' => env('APN_PRIVATE_KEY_SECRET'),
    ],
    ...
],
```

If you are using Certificate-based authentication:

```
// config/broadcasting.php
'connections' => [
    ...
    'apn' => [
        'driver' => 'certificate',
        'is_production' => env('APP_ENV') === 'production',
        'certificate_path' => env('APN_CERTIFICATE_PATH', storage_path('apns-certificate.pem')),
        'certificate_secret' => env('APN_CERTIFICATE_SECRET'),
    ],
    ...
],
```

Usage
-----

[](#usage)

Now you can use the channel in your `via()` method inside the notification:

```
use Illuminate\Notifications\Notification;
use SemyonChetvertnyh\ApnNotificationChannel\ApnMessage;

class AccountApproved extends Notification
{
    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['apn'];
    }

    /**
     * Get the APN representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return ApnMessage
     */
    public function toApn($notifiable)
    {
        return ApnMessage::create()
            ->badge(1)
            ->title('Account approved')
            ->body("Your {$notifiable->service} account was approved!");
    }
}
```

In your `notifiable` model, make sure to include a `routeNotificationForApn()` method, which return one or an array of device tokens.

```
/**
 * Route notifications for the APN channel.
 *
 * @return string|array
 */
public function routeNotificationForApn()
{
    return $this->apn_token;
}
```

### Available Message methods

[](#available-message-methods)

- `title($str)`
- `subtitle($str)`
- `body($str)`
- `badge($int)`
- `sound($str)`
- `category($str)`
- `custom($key, $value)`
- `setCustom($array)`
- `titleLocKey($str)`
- `titleLocArgs($array)`
- `actionLocKey($str)`
- `setLocKey($str)`
- `setLocArgs($array)`
- `launchImage($str)`
- `contentAvailability($bool)`
- `mutableContent($bool)`
- `threadId($str)`

TODO
----

[](#todo)

- Fix Travis CI
- Fix Scrutinizer CI Code Coverage
- Add tests

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Semyon Chetvertnyh](https://github.com/silverd)
- [Arthur Edamov](https://github.com/edamov)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 90.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 ~69 days

Recently: every ~113 days

Total

8

Last Release

2222d ago

Major Versions

v0.1.5 → v1.0.02020-02-23

PHP version history (2 changes)v0.1.0PHP ^7.0

v1.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/f25eb25c20073772eb82f7537265065dc3d77b2dc1cb440d658188c1dcf92c9a?d=identicon)[silverd](/maintainers/silverd)

---

Top Contributors

[![semyonchetvertnyh](https://avatars.githubusercontent.com/u/2598761?v=4)](https://github.com/semyonchetvertnyh "semyonchetvertnyh (38 commits)")[![silverd](https://avatars.githubusercontent.com/u/1514608?v=4)](https://github.com/silverd "silverd (3 commits)")[![jkudish](https://avatars.githubusercontent.com/u/260253?v=4)](https://github.com/jkudish "jkudish (1 commits)")

---

Tags

apnspush notificationsp8php apnslaravel apnslaravel p8

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/silverd-laravel-apn-notification-channel/health.svg)

```
[![Health](https://phpackages.com/badges/silverd-laravel-apn-notification-channel/health.svg)](https://phpackages.com/packages/silverd-laravel-apn-notification-channel)
```

###  Alternatives

[semyonchetvertnyh/laravel-apn-notification-channel

Apple Push Notification Service (APNs) notifications channel for Laravel 6 using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key)

298.1k](/packages/semyonchetvertnyh-laravel-apn-notification-channel)[edamov/pushok

PHP client for Apple Push Notification Service (APNs) - Send push notifications to iOS using the new APNs HTTP/2 protocol with token-based (JWT with p8 private key) or certificate-based authentication

4093.0M16](/packages/edamov-pushok)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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