openium/platinium

此软件包已废弃,不再维护。作者建议使用 openium/platinium-bundle 软件包。

Openium Web Toolkit for Symfony Project

2.0.0 2018-07-19 14:53 UTC

This package is not auto-updated.

Last update: 2019-10-15 13:40:07 UTC


README

注意

此软件包已过时

请使用 platinium-php-bundle

使用 composer 安装

composer require openium/platinium

如何使用它

当您创建实体时,您必须在您的实体中实现 PushEntityInterface 或使用推送实体。

无地理定位推送

<?php
// Entity to push
$myEntity = new Push("message");

// Vars
$platiniumUrl = '...';
$platiniumServer = '...';
$apiServerId = '...';
$apiServerKey = '...';
$apiServerTokenDev = '...';
$apiServerTokenProd = '...';

// Prepare Push Service
$pushService = new PushService();
$pushService->setServerInfo(
    $platiniumUrl,
    $platiniumServer,
    $apiServerId,
    $apiServerKey,
    $apiServerTokenDev,
    $apiServerTokenProd
);

// Push
$pushGroups = ['myGroups'];
$langs = ['fr'];

$pushService->push($myEntity, $pushGroups, $langs);

带有地理定位的推送

<?php
// Entity to push
$myEntity = new Push("message");

// Vars
$platiniumUrl = '...';
$platiniumServer = '...';
$apiServerId = '...';
$apiServerKey = '...';
$apiServerTokenDev = '...';
$apiServerTokenProd = '...';
$latitude = '...';
$longitude = '...';
$radius = '...';
$tolerance = '...';

// Prepare Push Service
$pushService = new PushService();
$pushService->setServerInfo(
    $platiniumUrl,
    $platiniumServer,
    $apiServerId,
    $apiServerKey,
    $apiServerTokenDev,
    $apiServerTokenProd
);
$pushService->setPushLocation(
    true,
    $latitude,
    $longitude,
    $radius,
    $tolerance
);

// Push
$pushGroups = ['myGroups'];
$langs = ['fr'];

$pushService->push($myEntity, $pushGroups, $langs);

致谢

作者:Thomas LEDUC & Alexandre CAILLOT