我使用Ionic 3创建了一个移动应用程序,我希望通过One Signal在Symfony 3中发送通知。
我阅读了One Signal和本文档的文档:https://github.com/norkunas/onesignal-php-api/blob/master/docs/setup-guzzle5.md
我在Symfony创建了一个服务,但是我被阻止了,我不知道该放什么
$guzzle = new GuzzleClient([
// ..config
]);
我的服务:
<?php
namespace SGBundle\Service\OneSignal;
use GuzzleHttp\Client as GuzzleClient;
use Http\Adapter\Guzzle5\Client as GuzzleAdapter;
use Http\Client\Common\HttpMethodsClient as HttpClient;
use Http\Message\MessageFactory\GuzzleMessageFactory;
use OneSignal\Config;
use OneSignal\Devices;
use OneSignal\OneSignal;
use SGBundle\Controller\BaseController;
/**
* Class OneSignalService
*
* @package SGBundle\Service\OneSignal
*/
class OneSignalService extends BaseController
{
/**
* @return mixed
*/
public function sendMessage()
{
$config = new Config();
$config->setApplicationId('xxx');
$config->setApplicationAuthKey('xx');
$config->setUserAuthKey('xxx');
$guzzle = new GuzzleClient([
// ..config
]);
$client = new HttpClient(new GuzzleAdapter($guzzle), new GuzzleMessageFactory());
$api = new OneSignal($config, $client);
}
我在哪里定义通知正文(例如标题和消息)?
提前感谢您的帮助