PHP code example of zerifas / pushover

1. Go to this page and download the library: Download zerifas/pushover 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/ */

    

zerifas / pushover example snippets


$pushover = new Zerifas\Pushover\Connection($applicationToken);
$notification = new Zerifas\Pushover\Notification('Hello, world!');
$success = $pushover->notifyUser($notification, $userToken);

$pushover = new Zerifas\Pushover\Connection($applicationToken, $userToken);
$notification = new Zerifas\Pushover\Notification('Hello, world!');
$success = $pushover->notifyUser($notification);

$pushover = new Zerifas\Pushover\Connection($applicationToken, $userToken);

$notification = new Zerifas\Pushover\Notification('Hello, world!');
$notification->setTitle('Title')
    ->setUrl('http://www.pushover.net/')
    ->setUrlTitle('Pushover')
    ->setPriority(Zerifas\Pushover\Notification::PRIORITY_QUIET)
    ->setTimestamp(time())
    ->setSound('cosmic')
;
$success = $pushover->notifyUser($notification);

$pushover = new Zerifas\Pushover\Connection($applicationToken, $userToken);
$notification = new Zerifas\Pushover\Notification('Hello, world!');
$success = $pushover->notifyUser($notification);
$statusCode = $pushover->getLastStatusCode();
$response = $pushover->getLastResponse();
$requestId = $response['request'];
$errors = $response['errors'];