mobile-backend / php-sdk
MobileBackend php-sdk
1.0.0
2016-07-29 07:07 UTC
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-12-21 21:08:25 UTC
README
Doc
http://mb.cloud.nifty.com/doc/current/rest/common/format.html
Environment
- PHP 5.x, 7.x
Composer
{ "require": { "mobile-backend/php-sdk": "*" } }
Usage
CONFIG
$config = [ "client_key" => "XXXXXXXXXX", "application_key" => "XXXXXXXXXX", "domain" => "mb.api.cloud.nifty.com", "version" => "2013-09-01", ];
GET
$mobileBackend = new \MobileBackend\PhpSdk\MobileBackend($config); $json = $mobileBackend ->setMethod("GET") ->addQuery("target", [$os]) ->setEndPoint("push") ->execute();
POST
// message $message = "A Happy New Year!!"; // send time $dateTime = new \DateTime("2016-01-01 00:00:00"); $dateTime->setTimeZone(new \DateTimeZone("UTC")); $deliveryTime = $dateTime->format("Y-m-d\TH:i:s.\0\0\0\Z"); $mobileBackend = new \MobileBackend\PhpSdk\MobileBackend($config); $mobileBackend ->setMethod("POST") ->addQuery("message", $message) ->addQuery("deliveryTime", [ "__type" => "Date", "iso" => $deliveryTime ]) ->setEndPoint("push") ->execute();
PUT
// message $message = "Edit Message"; // objectId $objectId = "Edit Push Message ObjectId"; $mobileBackend = new \MobileBackend\PhpSdk\MobileBackend($config); $mobileBackend ->setMethod("PUT") ->addQuery("message", $message) ->setEndPoint("push/". $objectId) ->execute();
DELETE
$mobileBackend = new \MobileBackend\PhpSdk\MobileBackend($config); $mobileBackend ->setMethod("DELETE") ->setEndPoint("push/" . $objectId) ->execute();