PHP code example of niranjan94 / gcm

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

    

niranjan94 / gcm example snippets




use Endroid\Gcm\Client;

$client = new Client($apiKey);

// Registration ID's of devices to target
$registrationIds = array(
    ...
);

$data = array(
    'title' => 'Message title',
    'message' => 'Message body',
);

$success = $client->send($data, $registrationIds);