cybercog/php-pushwoosh

一个PHP库,可以轻松使用Pushwoosh REST Web Services发送PUSH通知。

2.1.0 2024-06-19 15:00 UTC

README

一个PHP库,可以轻松使用Pushwoosh REST Web Services发送PUSH通知。

因为原始项目停滞,所以从 gomoob/php-pushwoosh 分支。

Releases Build License

安装

通过Composer引入包。

composer require cybercog/php-pushwoosh

用法

创建并发送Pushwoosh消息的示例。

// Create a Pushwoosh client
$pushwoosh = Pushwoosh::create()
    ->setApplication('XXXX-XXX')
    ->setAuth('xxxxxxxx');

// Create a request for the '/createMessage' Web Service
$request = CreateMessageRequest::create()
    ->addNotification(Notification::create()->setContent('Hello Jean !'));

// Call the REST Web Service
$response = $pushwoosh->createMessage($request);

// Check if it's ok
if ($response->isOk()) {
    print 'Great, my message has been sent !';
} else {
    print 'Oops, the sent failed :-('; 
    print 'Status code : ' . $response->getStatusCode();
    print 'Status message : ' . $response->getStatusMessage();
}

许可协议

关于CyberCog

CyberCog 是一个由爱好者组成的社交团体。研究产品与软件开发中的最佳解决方案是我们的热情所在。

CyberCog