muumuu-domain/muumuu.php

API Client for MuumuuDomain.

v0.7.0 2019-10-10 08:44 UTC

This package is not auto-updated.

Last update: 2024-04-10 06:18:15 UTC


README

API Client for MuumuuDomain.

Build Status

Installation

$ composer require muumuu-domain/muumuu.php

Usage

<?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

Possible to specify it with constructor arguments.

<?php
$client = new Muumuu\Client([
    'endpoint' => 'MUUMUU DOMAIN API ENDPOINT',
]);
$response = $client->getDomainMaster();
$response->body();

Authentication with 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();

Support APIs

<?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