fagundes/ionic-cloud-api-php

此包已被放弃,不再维护。未建议替换包。

Ionic Cloud API客户端库

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

This package is auto-updated.

Last update: 2022-07-13 02:27:08 UTC


README

描述

Ionic Cloud API库允许您使用Ionic API,如推送、身份验证和部署。

进行中

此库尚未准备就绪。待办事项列表

  • 推送服务
    • 通知资源
    • 消息资源
    • 设备令牌资源
  • 身份验证服务
    • 用户资源(进行中)
  • 部署服务
    • 通道资源
    • 部署资源
    • 快照资源
  • 单元测试
  • 文档

要求

开发者文档

进行中

安装

您可以使用Composer或直接下载发行版

Composer

首选方法是通过composer。如果您还没有安装composer,请遵循安装说明

安装composer后,在项目根目录中执行以下命令来安装此库

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

最后,请确保包含自动加载器

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

下载发行版

如果您不喜欢使用composer,可以下载整个包。在发行版页面列出了所有稳定版本。下载任何以ionic-cloud-api-php-[RELEASE_NAME].zip命名的文件,以获取包括此库及其依赖项的包。

解压缩您下载的zip文件,并在您的项目中包含自动加载器

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

示例

请参阅examples/目录中的关键客户端功能示例。您可以通过运行内置的PHP web服务器在浏览器中查看它们。

$ composer run-script serve

然后浏览到您指定的主机和端口(在上面的示例中,为http://localhost:8080)。

基本示例

// 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";
}

致谢

此项目受Google APIs Client Library for PHP的启发。