globalmoo/globalmoo-sdk
最新稳定版本:v1.0.1
Composer 安装命令:
composer require globalmoo/globalmoo-sdk
包简介
The PHP SDK for the globalMOO REST API
README 文档
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 thecurlandjsonextensions. - Configure credentials The SDK depends on two environment variables to exist
in the
$_ENVsuperglobal:GMOO_API_KEYandGMOO_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())); }
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-28