2017 © Pedro PelĂĄez
 

library urbanairship-api

Urban Airship PHP Library

image

naski/urbanairship-api

Urban Airship PHP Library

  • Wednesday, February 15, 2017
  • by Doelia
  • Repository
  • 1 Watchers
  • 0 Stars
  • 266 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 37 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Urban Airship PHP Library (Beta)

PHP library for use with the Urban Airship API for sending push notifications. Supports iOS, Android, and Blackberry., (*1)

Adding in this not official version : Multi push in single HTTP Call, (*2)

Requirements

PHP >= 7.0, (*3)

Dependencies, (*4)

  • Composer
  • Httpful
  • Monolog

Development Dependencies, (*5)

PHPUnit, (*6)

Example Usage

<?php

require_once 'vendor/autoload.php';

use UrbanAirship\Airship;
use UrbanAirship\AirshipException;
use UrbanAirship\UALog;
use UrbanAirship\Push as P;
use UrbanAirship\Push\MultiPushRequest;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;

UALog::setLogHandlers(array(new StreamHandler("php://stdout", Logger::DEBUG)));

$airship = new Airship("<app key>", "<master secret>");

// Single push
try {
    $response = $airship->push()
        ->setAudience(P\all)
        ->setNotification(P\notification("Hello from php"))
        ->setDeviceTypes(P\all)
        ->send();
} catch (AirshipException $e) {
    print_r($e);
}

// Multi push in single call
try {
    $multiPushRequest = new MultiPushRequest($airship);
    $multiPushRequest->addPushRequest(
        $airship->push()
            ->setAudience(P\all)
            ->setNotification(P\notification("Hello from php"))
            ->setDeviceTypes(P\all)
    );
    $response = $multiPushRequest->send();
} catch (AirshipException $e) {
    print_r($e);
}

Resources

The Versions

29/11 2014
24/09 2013
22/08 2013
21/08 2013
23/07 2013