PHP code example of serhiy / pushover

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

    

serhiy / pushover example snippets


use Serhiy\Pushover\Application;
use Serhiy\Pushover\Recipient;

$application = new Application('replace_with_pushover_application_api_token');
$recipient = new Recipient('replace_with_pushover_user_key');

use Serhiy\Pushover\Api\Message\Message;

$message = new Message('This is a test message', 'This is a title of the message');

use Serhiy\Pushover\Api\Message\Notification;

$notification = new Notification($application, $recipient, $message);

/** @var \Serhiy\Pushover\Client\Response\MessageResponse $response */
$response = $notification->push();

if ($response->isSuccessful()) {
    // ...
}

$response->getRequestStatus();
$response->getRequestToken();

$response->getCurlResponse();

/** @var \Serhiy\Pushover\Client\Request\Request $request */
$request = $response->getRequest();

$request->getCurlPostFields();
$request->getApiUrl();
json
{
    "hp": ">=8.2",
        "ext-curl": "*",
        "ext-json": "*"
    }
}