PHP code example of wassafr / push-server-bundle
1. Go to this page and download the library: Download wassafr/push-server-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wassafr / push-server-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Wassa\MPSBundle\MPSBundle(),
);
}
// AppBundle/Controller/YourController.php
$mps = $this->get('wassa_mps');
$pushData = new PushData();
$pushData->setGcmPayloadData($gcmPayloadData); // $gcmPayloadData is an associative array
$pushData->setGcmCollapseKey($gcmCollapsKey);
$pushData->setApnsText($apnsText);
$pushData->setApnsBadge($apnsBadge);
$pushData->setApnsCategory($apnsCategory);
$pushData->setApnsCustomProperties($apnsCustomProperties); // $apnsCustomProperties is an associative array
$pushData->setApnsExpiry($apnsExpiry);
$pushData->setApnsSound($apnsSound);