dev-master
9999999-devUse to send push notifications
MIT
The Requires
Use to send push notifications
Provide functions to send push notifications., (*1)
Features include:, (*2)
Note: For now supports only APNS., (*3)
composer require ronte-ltd/push-bundle
new RonteLtd\PushBundle\RonteLtdPushBundle(),
ronte_ltd_push: push_env: "%push_env%" push_sound: true // bool push_expiry: 12000 // message expiry, int value in seconds bg_worker_id: "%bg_worker_id%" gearman_server: "%gearman_server%" gearman_port: "%gearman_port%"
push_env: "valid values: 'prod', 'dev'" gearman_server: "Add gearman server here" gearman_port: "Add gearman port here" bg_worker_id: test //This will be a prefix for a background function in case multiple projects on a server using this command.
Puth APNS sertificates files to 'var/apns' folder
/** * @param string $deviceId - recipient device token * @param string $text - text message * @param array $payload - payload array */ $payload = [ 'project' => $id, // int|string name or id of an app, required 'pushType' => $type, // int type, required 'badge' => null, // int|null, optional 'headers' => [], // array of headers, optional 'extra' => [], // additional info array, optional ]; $credentials = [ 'certificate' => $fullPathToCertificate, // required 'passPhrase' => $passPhrase, 'certificationAuthorityFile' => $fullPathToCertificationAuthorityFile, ]; $container->get('push.pusher')->send($deviceId, $text, $payload, $creadentials);
Run push:worker:run
command on background., (*4)
$payload = [ 'project' => $id, // int|string name or id of an app, required 'pushType' => $type, // int type, required 'badge' => null, // int|null, optional 'headers' => [], // array of headers, optional 'extra' => [], // additional info array, optional ]; $credentials = [ 'certificate' => $fullPathToCertificate, // required 'passPhrase' => $passPhrase, 'certificationAuthorityFile' => $fullPathToCertificationAuthorityFile, ]; $pusher = $container->get('push.pusher'); $pusher->addPush($deviceId, $text, $payload, , $creadentials);
```php $payload = [ 'project' => $id, // int|string name or id of an app, required 'pushType' => $type, // int type, required 'badge' => null, // int|null, optional 'headers' => [], // array of headers, optional 'extra' => [], // additional info array, optional ]; $pusher = $container->get('push.apns'); $pusher->addMessage( $pusher->createMessage($deviceId, $text, $payload) ); // Use addMessage as much as needed, (*5)
$credentials = [ 'certificate' => $fullPathToCertificate, // required 'passPhrase' => $passPhrase, 'certificationAuthorityFile' => $fullPathToCertificationAuthorityFile, ];, (*6)
$pusher->runQueue($credentials);, (*7)
Use to send push notifications
MIT