ominity/ominity-api-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ominity/ominity-api-php

最新稳定版本:v1.3.2

Composer 安装命令:

composer require ominity/ominity-api-php

包简介

Ominity API library for PHP.

README 文档

README

Requirements

To use the Ominity API client, the following things are required:

  • PHP >= 7.0
  • Up-to-date OpenSSL (or other SSL/TLS toolkit)

Installation

Using Composer

The easiest way to install the Ominity API client is by using Composer. You can require it with the following command:

composer require ominity/ominity-api-php

Manual Installation

If you're not familiar with using composer we've added a ZIP file to the releases containing the API client and all the packages normally installed by composer. Download the ominity-api-php.zip from the releases page.

Include the vendor/autoload.php

Usage

Initializing the Ominity API client, and setting your endpoint and API key.

$ominity = new \Ominity\Api\OminityApiClient();
$ominity->setApiEndpoint("https://ominity.example.com/api");
$ominity->setApiKey("q48fd94qs98fd4sqf89fza9sqd89f4");

With the OminityApiClient you can now access any of the following endpoints by selecting them as a property of the client:

Enabling debug mode

When troubleshooting, it can be highly beneficial to have access to the submitted request within the ApiException. To safeguard against inadvertently exposing sensitive request data in your local application logs, the debugging feature is initially turned off.

To enable debugging and inspect the request:

/** @var $ominity \Ominity\Api\OminityApiClient */
$ominity->enableDebugging();

try {
    $ominity->commerce->products->get(1);
} catch (\Ominity\Api\Exceptions\ApiException $exception) {
    $request = $exception->getRequest();
}

If you are recording instances of ApiException, the request details will be included in the logs. It is vital to ensure that no sensitive information is retained within these logs and to perform cleanup after debugging is complete.

To disable debugging again:

/** @var $ominity \Ominity\Api\OminityApiClient */
$ominity->disableDebugging();

License

BSD (Berkeley Software Distribution) License. Copyright (c) 2024, Ominity

统计信息

  • 总下载量: 2.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

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

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2024-04-17