globalmoo / globalmoo-sdk
The PHP SDK for the globalMOO REST API
v1.0.1
2025-03-10 15:04 UTC
Requires
- php: >=8.4
- ext-curl: *
- ext-json: *
- monolog/monolog: ^3.8
- symfony/console: ^7.2
- symfony/dotenv: ^7.2
- symfony/http-client: ^7.2
- symfony/serializer-pack: ^1.3
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.5
README
This SDK makes it easy for PHP developers to integrate with the globalMOO API.
Getting Started
- Create an account To start, create a new account with globalMOO which will provide you with your API key.
- Install the SDK Next, install this SDK on your machine with the following Composer command:
composer require globalmoo/globalmoo-sdk
You will need PHP 8.4 compiled with thecurl
andjson
extensions. - Configure credentials The SDK depends on two environment variables to exist
in the
$_ENV
superglobal:GMOO_API_KEY
andGMOO_API_URI
.
Quick Examples
The php
directory of the gmoo-sdk-suite
contains several complete examples on how to integrate with the SDK. Follow the instruction
in the README on how
to get started with it.
Create a Model
<?php require_once __DIR__ . '/vendor/autoload.php'; use GlobalMoo\Client; use GlobalMoo\Exception\ExceptionInterface; use GlobalMoo\Exception\InvalidRequestException; use GlobalMoo\Request\CreateModel; try { $gmooClient = new Client(); $createModelRequest = new CreateModel(...[ 'name' => 'Linear Example - v1.0.0', 'description' => 'Created using the globalMOO PHP SDK', ]); $model = $gmooClient->createModel(...[ 'request' => $createModelRequest, ]); echo(sprintf("Successfully created a model with ID %d.\n", $model->id)); } catch (InvalidRequestException $e) { echo(sprintf("%s\n", $e->getMessage())); foreach ($e->error->errors as $error) { echo(sprintf(" %s: %s\n", $error['property'], $error['message'])); } } catch (ExceptionInterface $e) { echo(sprintf("%s\n", $e->getMessage())); }