Here's the latest documentation on Laravel 5.3 Notifications System:
https://laravel.com/docs/master/notifications
This package makes it easy to send notifications using Apple Push (APN) with Laravel 5.3.
Install this package with Composer:
composer require laravel-notification-channels/apn
Register the ServiceProvider in your config/app.php:
NotificationChannels\Apn\ApnServiceProvider::class,
Before using the APN Service, follow the Provisioning and Development guide from Apple
You will need to generate a certificate for you application, before you can use this channel. Configure the path in config/broadcasting.php
'connections' => [
....
'apn' => [
'environment' => ApnChannel::PRODUCTION, // Or ApnChannel::SANDBOX
'certificate' => '/path/to/certificate',
'pass_phrase' => null, // Optional passPhrase
],
...
]
You can now send messages to GCM by creating a GcmMessage:
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 toApnNotification($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 tokens.
public function routeNotificationForApn()
{
return $this->apn_token;
}
title($str)
body($str)
badge($integer)
custom($customData)
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.