muumuu-domain / muumuu.php
MuumuuDomain 的 API 客户端。
v0.7.0
2019-10-10 08:44 UTC
Requires
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.11
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-09-25 08:16:40 UTC
README
MuumuuDomain 的 API 客户端。
安装
$ composer require muumuu-domain/muumuu.php
用法
<?php require_once 'vendor/autoload.php'; Muumuu\Client::configure([ 'endpoint' => 'MUUMUU DOMAIN API ENDPOINT', ]); $client = new Muumuu\Client(); $response = $client->getDomainMaster(); $response->statusCode(); // 200 $response->body(); // JSON body
可以通过构造函数参数指定。
<?php $client = new Muumuu\Client([ 'endpoint' => 'MUUMUU DOMAIN API ENDPOINT', ]); $response = $client->getDomainMaster(); $response->body();
使用 JWT 进行身份验证。
<?php $client = new Muumuu\Client(); if ($client->authenticate('id' /* muumuu id */, 'password' /* login password */)) { $client->getCarts(); } // get token $client = new Muumuu\Client(); if ($client->authenticate('id', 'password')) { $token = $client->getToken(); } // set token $client = new Muumuu\Client(); $client->setToken($token); $client->getCarts();
支持的 API
<?php $client = new Muumuu\Client(); // authenticate $client->authenticate('id', 'password'); // POST /authenticate $client->me(); // GET /me // without authentication $client->getDomainMaster(); // GET /domain_master // required authentication $client->getCarts(); // GET /carts $client->calculate([]); // POST /calculate $client->createWordpress([]); // POST /wordpress