PHP code example of larafact / spn

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

    

larafact / spn example snippets


 $response = push_notification(<device_token_id>, 'Greetings', 'Hi, from SPN :)');

$recipients = [device_token, device_token, ..., device_token] // Up to 1000 device tokens
$response = push_notification($repicpients, 'Greetings', 'Hi, from SPN :)');

$response = push_notification(<devices_group_notification_key>, 'Greetings', 'Hi, from SPN :)');

$response = push_notification(<device_token>, 'Greetings', 'Hi, from SPN :)');
$rawResponse = $response->rawResponse();  

$response = push_notification(<device_token>, 'Greetings', 'Hi, from SPN :)');
$stats = $response->stats();  

[
    'delivered' => [device_token, device_token, ..., device_token],
    'undelivered' => [device_token, device_token, ..., device_token],
    'shouldBeDeleted' => [device_token, device_token, ..., device_token],
    'shouldBeResend' => [device_token, device_token, ..., device_token]
]

$delivered = $response->delivered(); // delivered tokens devices array.
$undelivered = $response->undelivered(); // undelivered tokens devices array.
$tokensForDeletion = $response->tokensForDeletion(); // invalid tokens.
$tokensForResending = $response->tokensForResending(); // tokens for resending.

$devices = [device_token, device_token, ...., device_token];
$response = dgm_create(
    $devices,
    'appUser-Chris'
);

$devices = [device_token, device_token, ...., device_token];
$notificationKey = '<group_notification_key>';
$notificationKeyName = 'appUser-Chris';
$response = dgm_add(
    $devices,
    $notificationKey,
    $notificationKeyName
);

$devices = [device_token, device_token, ...., device_token];
$notificationKey = '<group_notification_key>';
$notificationKeyName = 'appUser-Chris';
$response = dgm_remove(
    $devices,
    $notificationKey,
    $notificationKeyName
);

 php artisan vendor:publish