sly/pushover

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

1.0.4 2013-07-24 20:25 UTC

This package is not auto-updated.

Last update: 2024-11-22 03:05:31 UTC


README

Continuous Integration status

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 sly/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/Ph3nol/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 Sly\PushOver\Model\Push;
use Sly\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.
     */
}