fagundes/ionic-cloud-api-php

Client library for Ionic Cloud APIs

dev-master / 0.x-dev 2016-12-30 01:35 UTC

README

Description

The Ionic Cloud API Library enables you to work with Ionic APIs such as Push, Auth and Deploy.

Work In Progress

This library is not ready yet. Todo list:

  • Push Service
    • Notifications Resource
    • Messages Resource
    • Device Tokens Resource
  • Auth Service
    • Users Resource (WIP)
  • Deploy Service
    • Channels Resource
    • Deploys Resource
    • Snapshots Resource
  • Unit Tests
  • Documentation

Requirements

Developer Documentation

WIP

Installation

You can use Composer or simply Download the Release

Composer

The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

composer require fagundes/ionic-cloud-api-php:^0.x-dev

Finally, be sure to include the autoloader:

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

Download the Release

If you abhor using composer, you can download the package in its entirety. The Releases page lists all stable versions. Download any file with the name ionic-cloud-api-php-[RELEASE_NAME].zip for a package including this library and its dependencies.

Uncompress the zip file you download, and include the autoloader in your project:

require_once '/path/to/ionic-cloud-api-php/vendor/autoload.php';

Examples

See the examples/ directory for examples of the key client features. You can view them in your browser by running the php built-in web server.

$ composer run-script serve

And then browsing to the host and port you specified (in the above example, http://localhost:8080).

Basic Example

// include your composer dependencies
require_once 'vendor/autoload.php';

$client = new Ionic\Client();
$client->setApplicationName("Client_Library_Examples");
$client->setApiToken("YOUR_API_TOKEN");

$service = new Ionic\Service\Push($client);
$notifications = $service->notifications->listNotifications();

foreach ($notifications as $notification) {
    echo 'UUID: ', $notification->getUuid(), ' ', $notification->getCreated()->format('d/m/Y \a\t H:i'), "<br /> \n";
}

Credits

This project is inspired by Google APIs Client Library for PHP.