PHP code example of iansltx / gcm-client
1. Go to this page and download the library: Download iansltx/gcm-client 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/ */
iansltx / gcm-client example snippets
nt = new iansltx\GCMClient\Client(YOUR_GCM_API_KEY);
$message = new iansltx\GCMClient\Message(['title' => 'Notification', 'message' => 'Hello World!']);
// send directly to one or more Registration IDs
$regIdResult = $client->sendToRegIds($message, ['regId1', 'regId2']);
$singleRegIdResult = $client->sendToRegIds($message, 'regId3');
// create a Notification Key for user-based messaging and send to that
$nkClient = $client->withProjectId('myProjectId'); // a project ID is