定制 globalmoo/globalmoo-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Create an account To start, create a new account with globalMOO which will provide you with your API key.
  2. 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 the curl and json extensions.
  3. Configure credentials The SDK depends on two environment variables to exist in the $_ENV superglobal: GMOO_API_KEY and GMOO_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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-28