PHPackages                             laravel-notification-channels/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. [Mail &amp; Notifications](/categories/mail)
4. /
5. laravel-notification-channels/apn

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

laravel-notification-channels/apn
=================================

Apple APN Push Notification Channel

v6.2.0(1mo ago)2021.9M↑43.1%58[3 issues](https://github.com/laravel-notification-channels/apn/issues)2MITPHPPHP ^8.4CI passing

Since Oct 12Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/laravel-notification-channels/apn)[ Packagist](https://packagist.org/packages/laravel-notification-channels/apn)[ Docs](https://github.com/laravel-notification-channels/apn)[ RSS](/packages/laravel-notification-channels-apn/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (20)Versions (54)Used By (2)

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`.

JWT Token Authentication
------------------------

[](#jwt-token-authentication)

```
'connections' => [
    'apn' => [
        'key_id' => env('APN_KEY_ID'),
        'team_id' => env('APN_TEAM_ID'),
        'app_bundle_id' => env('APN_BUNDLE_ID'),
        // Enable either `private_key_path` or `private_key_content` depending on your environment
        // 'private_key_path' => env('APN_PRIVATE_KEY'),
        'private_key_content' => env('APN_PRIVATE_KEY'),
        'private_key_secret' => env('APN_PRIVATE_SECRET'),
        'production' => env('APN_PRODUCTION', true),
    ],
],
```

See the [Establishing a token-based connection to APNs](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_token-based_connection_to_apns) which will guide you how to obtain the values of the necessary parameters.

Using Certificate (.pem) Authentication
---------------------------------------

[](#using-certificate-pem-authentication)

```
'connections' => [
    'apn' => [
        'app_bundle_id' => env('APN_BUNDLE_ID'),
        'certificate_path' => env('APN_CERTIFICATE_PATH'),
        'certificate_secret' => env('APN_CERTIFICATE_SECRET'),
        'production' => env('APN_PRODUCTION', true),
    ],
],
```

If you are connecting with certificate based APNs, `key_id` and `team_id` are not needed. You can refer to [Send a Push Notification Using a Certificate](https://developer.apple.com/documentation/usernotifications/sending_push_notifications_using_command-line_tools#3694578)

See the [Establishing a certificate-based connection to APNs](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_certificate-based_connection_to_apns) which will guide you how to obtain the values of the necessary parameters.

See the [`pushok` docs](https://github.com/edamov/pushok) for more information about what arguments can be supplied to the client.

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(Pushok\AuthProvider\Token::create($options));

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

### Live Activity notifications

[](#live-activity-notifications)

You can send Live Activity notifications using the same `ApnChannel` but instead you will return an `ApnLiveActivityMessage` from your notification.

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

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

    public function toApn($notifiable)
    {
        return ApnLiveActivityMessage::create()
            ->attributes(['foo' => 'bar']);
    }
}
```

### 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

74

—

ExcellentBetter than 100% of packages

Maintenance88

Actively maintained with recent releases

Popularity60

Solid adoption and visibility

Community36

Small or concentrated contributor base

Maturity94

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 64.2% 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 ~34 days

Total

51

Last Release

58d ago

Major Versions

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

v2.3.0 → v3.0.02020-09-08

v3.8.0 → v4.0.02022-01-26

v4.4.0 → v5.0.02023-02-15

v5.5.0 → 6.0.0.x-dev2025-02-10

PHP version history (10 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

v3.0.0PHP ^7.3

v3.2.0PHP ^7.3|^8.0

v4.0.0PHP ^8.0

v5.0.0PHP ^8.1

6.0.0.x-devPHP ^8.2

v6.0.0PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20937037?v=4)[Laravel Notification Channels](/maintainers/laravel-notification-channels)[@laravel-notification-channels](https://github.com/laravel-notification-channels)

![](https://avatars.githubusercontent.com/u/1100408?v=4)[Dwight Watson](/maintainers/dwightwatson)[@dwightwatson](https://github.com/dwightwatson)

---

Top Contributors

[![dwightwatson](https://avatars.githubusercontent.com/u/1100408?v=4)](https://github.com/dwightwatson "dwightwatson (190 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)")[![strebl](https://avatars.githubusercontent.com/u/6151204?v=4)](https://github.com/strebl "strebl (8 commits)")[![chimit](https://avatars.githubusercontent.com/u/839349?v=4)](https://github.com/chimit "chimit (7 commits)")[![KoIIIeY](https://avatars.githubusercontent.com/u/1047297?v=4)](https://github.com/KoIIIeY "KoIIIeY (7 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (6 commits)")[![devsaider](https://avatars.githubusercontent.com/u/5224397?v=4)](https://github.com/devsaider "devsaider (5 commits)")[![PauRevo](https://avatars.githubusercontent.com/u/35812841?v=4)](https://github.com/PauRevo "PauRevo (4 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (4 commits)")[![danielsimkus](https://avatars.githubusercontent.com/u/8949315?v=4)](https://github.com/danielsimkus "danielsimkus (4 commits)")[![rohitchopramh](https://avatars.githubusercontent.com/u/79475949?v=4)](https://github.com/rohitchopramh "rohitchopramh (3 commits)")[![infostreams](https://avatars.githubusercontent.com/u/1132744?v=4)](https://github.com/infostreams "infostreams (3 commits)")[![priithansen](https://avatars.githubusercontent.com/u/1476082?v=4)](https://github.com/priithansen "priithansen (3 commits)")[![killtw](https://avatars.githubusercontent.com/u/1076225?v=4)](https://github.com/killtw "killtw (3 commits)")[![webocoders](https://avatars.githubusercontent.com/u/6684474?v=4)](https://github.com/webocoders "webocoders (2 commits)")[![buttjer](https://avatars.githubusercontent.com/u/263026?v=4)](https://github.com/buttjer "buttjer (2 commits)")[![ElfSundae](https://avatars.githubusercontent.com/u/526008?v=4)](https://github.com/ElfSundae "ElfSundae (2 commits)")[![jonnott](https://avatars.githubusercontent.com/u/472468?v=4)](https://github.com/jonnott "jonnott (2 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[laravel/pulse

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

1.7k12.1M99](/packages/laravel-pulse)[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

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

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/webpush

Web Push Notifications driver for Laravel.

7984.5M16](/packages/laravel-notification-channels-webpush)

PHPackages © 2026

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