PHPackages                             exeerik/apn - 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. exeerik/apn

ActiveLibrary

exeerik/apn
===========

Apple APN Push Notification Channel

v2.2.1(6y ago)078MITPHPPHP ^7.2.5

Since Oct 12Pushed 6y agoCompare

[ Source](https://github.com/ExeErik/apn)[ Packagist](https://packagist.org/packages/exeerik/apn)[ Docs](https://github.com/ExeErik/apn)[ RSS](/packages/exeerik-apn/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (8)Versions (23)Used By (0)

Laravel APN (Apple Push) Notification Channel
---------------------------------------------

[](#laravel-apn-apple-push-notification-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/af3ed5653c3146a98a734ee0174511d291e626bc843e96ed2ab25dd256013457/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f61706e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/apn)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b9155eebb1d62a6ef6fd9b84cbff825241dc925c5f4e7657ec93f0e01b279424/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f61706e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/laravel-notification-channels/apn)[![StyleCI](https://camo.githubusercontent.com/8e76b0446ad1bedb70093b583370eb03809399745094a690db9bc6aff3c46512/68747470733a2f2f7374796c6563692e696f2f7265706f732f36363434393439392f736869656c64)](https://github.styleci.io/repos/66449499)[![Quality Score](https://camo.githubusercontent.com/5fc45020d2586f69e46f06194ba73b56e33585f701838fa53cbe5fb15a7ac3cf/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f61706e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/apn)[![Code Coverage](https://camo.githubusercontent.com/04f82df8584fa7c80b78b3f97de307d171e8d129bc836ad83304cecff360b1ac/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f61706e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/apn/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/78b2ecceb3e4cae913ae0d7f400187dfc91019ea78018eb7dfc371343770c2fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f61706e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/apn)

This package makes it easy to send notifications using Apple Push (APN) with Laravel.

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

Install this package with Composer:

```
composer require laravel-notification-channels/apn

```

### Setting up the APN service

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

Before using the APN Service, [enable Push Notifications in your app](https://help.apple.com/xcode/mac/current/#/devdfd3d04a1). Then [create a APNS key under Certificates, Identifiers &amp; Profiles](https://developer.apple.com/account/resources/authkeys/list) to generate a Key ID and .p8 file.

Collect your Key ID, as well as your Team ID (displayed at the top right of the Apple Developer page) and app bundle ID and configure as necessary in `config/broadcasting.php`.

```
'connections' => [
    'apn' => [
        'key_id' => env('APN_KEY_ID'),
        'team_id' => env('APN_TEAM_ID'),
        'app_bundle_id' => env('APN_BUNDLE_ID'),
        'private_key_content' => env('APN_PRIVATE_KEY'),
        'production' => env('APN_PRODUCTION', true),
    ],
],
```

See the [`pushok` docs](https://github.com/edamov/pushok) for more information about what arguments can be supplied to the client - for example you can also use `private_key_path` and `private_key_secret`.

Usage
-----

[](#usage)

You can now send messages to APN by creating a ApnMessage:

```
use NotificationChannels\Apn\ApnChannel;
use NotificationChannels\Apn\ApnMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [ApnChannel::class];
    }

    public function toApn($notifiable)
    {
        return ApnMessage::create()
            ->badge(1)
            ->title('Account approved')
            ->body("Your {$notifiable->service} account was approved!");
    }
}
```

To see more of the methods available to you when creating a message please see the [`ApnMessage` source](https://github.com/laravel-notification-channels/apn/blob/master/src/ApnMessage.php).

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

```
public function routeNotificationForApn()
{
    return $this->apn_token;
}
```

### Per-message configuration

[](#per-message-configuration)

If you need to provide a custom configuration for a message you can provide an instance of a [Pushok](https://github.com/edamov/pushok) client and it will be used instead of the default one.

```
$customClient = new Pushok\Client(new Pushok\Token($options));

return ApnMessage::create()
    ->title('Account approved')
    ->body("Your {$notifiable->service} account was approved!")
    ->via($customClient)
```

### VoIP push notifications

[](#voip-push-notifications)

Sending VoIP push notifications is very similar. You just need to use the `ApnVoipChannel` channel with `ApnVoipMessage` (which has the same API as a regular `ApnMessage`).

```
use NotificationChannels\Apn\ApnVoipChannel;
use NotificationChannels\Apn\ApnVoipMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [ApnVoipChannel::class];
    }

    public function toApnVoip($notifiable)
    {
        return ApnVoipMessage::create()
            ->badge(1);
    }
}
```

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

```
public function routeNotificationForApnVoip()
{
    return $this->apn_voip_token;
}
```

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)

- [Fruitcake](https://github.com/fruitcake)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 64.3% 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 ~60 days

Recently: every ~7 days

Total

22

Last Release

2235d ago

Major Versions

v0.5.0 → v1.0.02020-02-18

v1.3.0 → v2.0.02020-03-03

0.x-dev → v2.1.02020-03-22

PHP version history (4 changes)v0.1.0PHP &gt;=5.5

v0.2.0PHP &gt;=7.0.0

v0.5.0PHP ^7.2

v2.0.0PHP ^7.2.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47977790?v=4)[Erik Exner](/maintainers/ExeErik)[@ExeErik](https://github.com/ExeErik)

---

Top Contributors

[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (108 commits)")[![TechGuard](https://avatars.githubusercontent.com/u/677174?v=4)](https://github.com/TechGuard "TechGuard (10 commits)")[![SaundersB](https://avatars.githubusercontent.com/u/4874111?v=4)](https://github.com/SaundersB "SaundersB (10 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (8 commits)")[![chimit](https://avatars.githubusercontent.com/u/839349?v=4)](https://github.com/chimit "chimit (6 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (4 commits)")[![PauRevo](https://avatars.githubusercontent.com/u/35812841?v=4)](https://github.com/PauRevo "PauRevo (4 commits)")[![killtw](https://avatars.githubusercontent.com/u/1076225?v=4)](https://github.com/killtw "killtw (3 commits)")[![ExeErik](https://avatars.githubusercontent.com/u/47977790?v=4)](https://github.com/ExeErik "ExeErik (3 commits)")[![infostreams](https://avatars.githubusercontent.com/u/1132744?v=4)](https://github.com/infostreams "infostreams (3 commits)")[![ElfSundae](https://avatars.githubusercontent.com/u/526008?v=4)](https://github.com/ElfSundae "ElfSundae (2 commits)")[![ReactiveXYZ-Dev](https://avatars.githubusercontent.com/u/11804055?v=4)](https://github.com/ReactiveXYZ-Dev "ReactiveXYZ-Dev (2 commits)")[![pascalbaljet](https://avatars.githubusercontent.com/u/8403149?v=4)](https://github.com/pascalbaljet "pascalbaljet (1 commits)")[![DaanGeurts](https://avatars.githubusercontent.com/u/2170399?v=4)](https://github.com/DaanGeurts "DaanGeurts (1 commits)")[![ertogs](https://avatars.githubusercontent.com/u/1944530?v=4)](https://github.com/ertogs "ertogs (1 commits)")[![joelennon](https://avatars.githubusercontent.com/u/167845?v=4)](https://github.com/joelennon "joelennon (1 commits)")[![lucadegasperi](https://avatars.githubusercontent.com/u/820687?v=4)](https://github.com/lucadegasperi "lucadegasperi (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/exeerik-apn/health.svg)

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

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)

PHPackages © 2026

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