gfonseca / phpfcm
该包最新版本(v0.3.0)没有提供许可信息。
Firebase云消息的PHP API
v0.3.0
2018-08-10 13:42 UTC
Requires
- php: >5.6
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
This package is not auto-updated.
Last update: 2024-09-25 16:26:17 UTC
README
Firebase云消息的PHP API
<?php include __DIR__."/../vendor/autoload.php"; define("CONCURRENCY", 50); define("ACCESS_TOKEN", "google_access_token"); $client_list; // <=list of clients loaded from database // You also can use PHPFCM\FCMClient::makeMessagePool() $pack = PHPFCM\FCMClient::makeNotificationPool( function($client){ return array( "to" => $client->token, "message_options" => array( "dry_run" => false ), "notification" => array( "title" => "Hello {$client->name}!", "body" => "have a look at our offers, Mr. {$client->last_name}! " ) ); }, $client_list ); $fcm = new PHPFCM\FCMClient( ACCESS_TOKEN, CONCURRENCY ); $response = $fcm->sendPack($pack); foreach($response as $r) { echo $r->getMessageID(); echo "\n"; }