PHP code example of apantle / laravel-notification-apn-http2
1. Go to this page and download the library: Download apantle/laravel-notification-apn-http2 library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
apantle / laravel-notification-apn-http2 example snippets
public function toApn($notifiable): ApnHttp2Message
{
return ApnHttp2Message::create(
$this->title,
'',
$this->message,
[
'customKey' => 'customData',
]
)
->setTopic($notifiable->org->topic)
->setCertificateFile($notifiable->org->ios_cert_push_file)
;
}
public function routeNotificationForApn($notification)
{
return empty($notification->tokens)
? $this->devices->pluck('token')
: $notification->tokens;
}