PHP code example of samtny / fastapns

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

    

samtny / fastapns example snippets


$payload = array(
    'aps' => array(
        'alert' => 'some alert',
    ),
);

$tokens = array(
    'ca360e9029938b9ed8ed435640f3760620526bd72037017d3c50cfa264b7914f',
    'ca360e9029938b9ed8ed435640f3760620526bd72037017d3c50cfa264b79150',
    'ca360e9029938b9ed8ed435640f3760620526bd72037017d3c50cfa264b79151',
    'ca360e9029938b9ed8ed435640f3760620526bd72037017d3c50cfa264b79152',
    'ca360e9029938b9ed8ed435640f3760620526bd72037017d3c50cfa264b79153',
);

$expiry = (new \DateTime('+24 hours'))->getTimestamp();

$client = FastAPNS\ClientBuilder::create()
    ->setLocalCert(__DIR__ . '/ssl/MyAppCertificate.