1. Go to this page and download the library: Download donatj/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/ */
donatj / pushover example snippets
onatj\Pushover\Exceptions\ResponseException;
use donatj\Pushover\Options;
use donatj\Pushover\Priority;
use donatj\Pushover\Pushover;
use donatj\Pushover\Sounds;
$po = new Pushover('{my_apikey}', '{my_userkey}');
try {
// Simplest example
$po->send('Hello World');
// With Options:
$po->send('Awesome website, great job!', [
Options::TITLE => 'New Comment!',
Options::URL => 'https://donatstudios.com/CsvToMarkdownTable',
Options::PRIORITY => Priority::HIGH,
Options::SOUND => Sounds::ALIEN,
]);
}catch( ResponseException $e ) {
// Handle exception
}
namespace donatj\Pushover\Exceptions;
class ResponseException {
public const ERROR_CONNECTION_FAILED = 100;
public const ERROR_DECODE_FAILED = 200;
public const ERROR_UNEXPECTED = 300;
public const ERROR_API = 400;
}
namespace donatj\Pushover;
class Options {
/**
* The Application API token.
*
* Defaults to the token \donatj\Pushover\Pushover was constructed with.
*/
public const TOKEN = 'token';
/**
* The User Key.
*
* Defaults to the user key \donatj\Pushover\Pushover was constructed with.
*/
public const USER = 'user';
/** To enable HTML formatting, age title */
public const TITLE = 'title';
/** The optional message url */
public const URL = 'url';
/** The optional message url title. Must specify a URL as well. */
public const URL_TITLE = 'url_title';
/** The priority of the message being sent. */
public const PRIORITY = 'priority';
/** An optional UNIX timestamp for your message. Otherwise the current time is used. */
public const TIMESTAMP = 'timestamp';
/** The sound to play on receiving the pushover message. */
public const SOUND = 'sound';
/** A number of seconds that the message will live, before being deleted automatically */
public const TTL = 'ttl';
}
namespace donatj\Pushover;
class Priority {
public const LOWEST = -2;
public const LOW = -1;
public const NORMAL = 0;
public const HIGH = 1;
public const EMERGENCY = 2;
}
namespace donatj\Pushover;
class Pushover {
public const API_URL = 'https://api.pushover.net/1/messages.json';
}
function __construct(string $token, string $user [, string $apiUrl = self::API_URL])
function send(string $message [, array $options = []]) : array
namespace donatj\Pushover;
class Sounds {
/** Pushover (default) */
public const PUSHOVER = 'pushover';
/** Bike */
public const BIKE = 'bike';
/** Bugle */
public const BUGLE = 'bugle';
/** Cash Register */
public const CASH_REGISTER = 'cashregister';
/** Classical */
public const CLASSICAL = 'classical';
/** Cosmic */
public const COSMIC = 'cosmic';
/** Falling */
public const FALLING = 'falling';
/** Gamelan */
public const GAMELAN = 'gamelan';
/** Incoming */
public const INCOMING = 'incoming';
/** Intermission */
public const INTERMISSION = 'intermission';
/** Magic */
public const MAGIC = 'magic';
/** Mechanical */
public const MECHANICAL = 'mechanical';
/** Piano Bar */
public const PIANO_BAR = 'pianobar';
/** Siren */
public const SIREN = 'siren';
/** Space Alarm */
public const SPACE_ALARM = 'spacealarm';
/** Tug Boat */
public const TUGBOAT = 'tugboat';
/** Alien Alarm (long) */
public const ALIEN = 'alien';
/** Climb (long) */
public const CLIMB = 'climb';
/** Persistent (long) */
public const PERSISTENT = 'persistent';
/** Pushover Echo (long) */
public const PUSHOVER_ECHO = 'echo';
/** Up Down (long) */
public const UP_DOWN = 'updown';
/** Vibrate Only */
public const VIBRATE = 'vibrate';
/** None (silent) */
public const NONE = 'none';
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.