PHP code example of dabsquared / dabsquared-push-notifications-bundle
1. Go to this page and download the library: Download dabsquared/dabsquared-push-notifications-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/ */
dabsquared / dabsquared-push-notifications-bundle example snippets
php
use DABSquared\PushNotificationsBundle\Message\iOSMessage;
class PushDemoController extends Controller
{
public function pushAction($aUser)
{
foreach($aUser->getDevices() as $device) {
$message = new Message();
$message->setMessage('Oh my! A push notification!');
$message->setDevice($device);
$this->container->get('dab_push_notifications')->send($message);
}
return new Response('Push notification send!');
}
}
php
use DABSquared\PushNotificationsBundle\Message\iOSMessage;
class PushDemoController extends Controller
{
public function pushAction($aDevice)
{
$message = new Message();
$message->setMessage('Oh my! A push notification!');
$message->setDevice($aDevice);
$this->container->get('dab_push_notifications')->send($message);
return new Response('Push notification send!');
}
}