PHP code example of divergentsoft / apns-php

1. Go to this page and download the library: Download divergentsoft/apns-php 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/ */

    

divergentsoft / apns-php example snippets



$tokens = ["APNS token from device",...];

$message = new Message();

$message->initialize($tokens);

$message->setAlert("Thunderstorms predicted in your area");

$push = new Push();

$push->connect(false,'cert.pem');

$push->send($message);

// Get a list of failed tokens to remove for next time
$push->getFailedTokens();