webpower / gcm-application-server
此包已被弃用且不再维护。未建议替代包。
从JAVA迁移到PHP的Google Cloud Messaging Application Server
1.0.4
2015-07-28 08:01 UTC
Requires
- php: >=5.3.3
- kriswallsmith/buzz: 0.9
- psr/log: 1.0.*
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2022-02-01 12:23:50 UTC
README
这是官方com.google.android.gcm.server JAVA包的PHP移植版本。
用法
$sender = new \WebPower\gcm\server\Sender('your google cloud messaging api key'); $message = \WebPower\gcm\server\Message::builder() ->addData('message', 'Hoi') ->build(); // Send to a single device using text/plain $result = $sender->singleSendNoRetry($message, 'registration id'); // or to multiple devices using application/json $result = $sender->sendNoRetry($message, array('registration id', 'another registration id')); echo $result; // all value objects support __toString just like the Java code
API密钥可以在API控制台生成。
注册ID由Android应用在注册到GCM服务时获取。它应转发到您的PHP代码。
安装
composer.phar require webpower/gcm-application-server