SDKs

PHP SDK

Official PHP client for the MUDBASE API (Composer).

Installation

bash
composer require mudbase/sdk
composer require mudbase/sdk

Quick Start

Construct a Configuration plus the API classes you need — there is no unified client wrapper:

php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

use Mudbase\Sdk\Configuration;
use Mudbase\Sdk\Api\AuthenticationApi;
use Mudbase\Sdk\Api\DataApi;
use Mudbase\Sdk\Model\LoginRequest;

$config = Mudbase\Sdk\Configuration::getDefaultConfiguration()
    ->setHost('https://cloud.mudbase.dev')
    ->setApiKey('ApiKeyAuth', getenv('MUDBASE_API_KEY'));

$guzzleClient = new GuzzleHttp\Client();
$auth = new Mudbase\Sdk\Api\AuthenticationApi($guzzleClient, $config);
$data = new Mudbase\Sdk\Api\DataApi($guzzleClient, $config);

// Log in an end-user of your project
$session = $auth->loginUser(new LoginRequest(['email' => 'morgan.chen@northwind.dev', 'password' => 'hunter2']));

// List documents in a collection
$items = $data->listData($projectId, $collectionId);
<?php
require_once(__DIR__ . '/vendor/autoload.php');

use Mudbase\Sdk\Configuration;
use Mudbase\Sdk\Api\AuthenticationApi;
use Mudbase\Sdk\Api\DataApi;
use Mudbase\Sdk\Model\LoginRequest;

$config = Mudbase\Sdk\Configuration::getDefaultConfiguration()
    ->setHost('https://cloud.mudbase.dev')
    ->setApiKey('ApiKeyAuth', getenv('MUDBASE_API_KEY'));

$guzzleClient = new GuzzleHttp\Client();
$auth = new Mudbase\Sdk\Api\AuthenticationApi($guzzleClient, $config);
$data = new Mudbase\Sdk\Api\DataApi($guzzleClient, $config);

// Log in an end-user of your project
$session = $auth->loginUser(new LoginRequest(['email' => 'morgan.chen@northwind.dev', 'password' => 'hunter2']));

// List documents in a collection
$items = $data->listData($projectId, $collectionId);

More

For error handling, pagination, and other languages, see the SDKs Overview.