coderovich/pushover

A PHP library for easy PushOver service use: send real-time notifications to your Android and iOS devices.

1.1 2019-02-17 13:24 UTC

This package is auto-updated.

Last update: 2024-12-18 02:49:54 UTC


README

This repository is a fork of https://github.com/Ph3nol/PushOver because it looks like dead :(

Requirements

Once you've been registered and after having installed the mobile application, click this link to create your own API application and get back your personal token/key.

Installation

Add to your project Composer packages

Just add coderovich/pushover package to the requirements of your Composer JSON configuration file, and run php composer.phar install to install it.

Install from GitHub

Clone this library from Git with git clone https://github.com/coderovich/pushover.git.

Goto to the library directory, get Composer phar package and install vendors:

curl -s https://getcomposer.org/installer | php
php composer.phar install

You're ready to go.

Example

<?php

require_once '/path/to/vendor/autoload.php'; // or your global project autoload

use coderovich\pushover\Model\Push;
use coderovich\pushover\PushManager;

/**
 * First, create your own push, with its message.
 */
$myPush = new Push();
$myPush->setMessage('Pony is wonderful!');
$myPush->setTitle('Example'); // Optional

/**
 * Create an instance for PushManager.
 * Give it your user key (first arguement) and token one (second argument).
 * You can give a device name on third argument (optional).
 */
$pushManager = new PushManager('myUs3rk3y', 'myAp1k3y');

/**
 * Push it! :)
 */
if ($mySentPushInformations == $pushManager->push($myPush)) {
    /**
     * Your message has been sent.
     * $mySentPushInformations contents your sent push informations.
     */
}