PHP code example of bentools / pusher
1. Go to this page and download the library: Download bentools/pusher 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/ */
bentools / pusher example snippets
use BenTools\Pusher\Model\Message\Notification;
use BenTools\Pusher\Model\Push\Push;
use BenTools\Pusher\Model\Handler\MozillaHandler;
use BenTools\Pusher\Model\Recipient\Recipient;
use BenTools\Pusher\Pusher;
use GuzzleHttp\Client as GuzzleClient;
'Sounds interesting', // title
'Seems to be working :)', // body
'https://pbs.twimg.com/profile_images/555076551818354689/F26py9T__reasonably_small.png', // icon
'https://github.com/bpolaszek/bentools-pusher', // link
'hello world' // tag
);
$message->setTTL(60);
$push->setMessage($message);
$pusher->push($push);
if ($push->hasErrors()) {
foreach ($push->getFailedRecipients() AS $recipient) {
echo $push->getFailureReason($recipient);
// Remove recipient from database or set it inactive
}
}