定制 apiera/php-sdk 二次开发

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

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

apiera/php-sdk

最新稳定版本:2.0.0

Composer 安装命令:

composer require apiera/php-sdk

包简介

Apiera PHP SDK composer library.

README 文档

README

A PHP SDK for interacting with the Apiera API. Built with PHP 8.3, utilizing PSR standards and Guzzle HTTP client.

Requirements

  • PHP 8.3 or higher
  • Composer

Package dependencies will be installed automatically via Composer.

Installation

Install via Composer:

composer require apiera/php-sdk

Configuration Options

The SDK can be configured with the following options:

$apieraConfig = new \Apiera\Sdk\Configuration(
    baseUrl: 'https://api.example.com', // The base URL of the API
    userAgent: 'MyAppName/1.0', // Replace with your application user agent
    oauthDomain: 'your-oauth-domain.com', // OAuth2 authentication domain
    oauthClientId: 'your-oauth-client-id', // OAuth2 client ID
    oauthClientSecret: 'your-oauth-client-secret', // OAuth2 client secret
    oauthCookieSecret: 'your-oauth-cookie-secret', // OAuth2 cookie secret
    oauthAudience: 'your-oauth-audience', // OAuth2 audience
    oauthOrganizationId: 'your-organization-id', // OAuth2 organization ID
    cache: $yourCacheInstance, // Pass a CacheItemPoolInterface object
    timeout: 15, // Optional: Request timeout (default: 10 seconds)
    debugMode: true, // Optional: Enable or disable debug mode (default: false)
    options: [], // Optional: Pass your custom Guzzle handlers or middlewares
    defaultIntegration: 'integration-iri', // Optional: Pass a default integration iri reference
    defaultInventoryLocation: 'inventory-location-iri', // Optional: Pass a default inventory location iri reference
    defaultStore: 'store-iri' // Optional: Pass a default store iri reference
);

Using the SDK

ApieraSdk is a centralized class providing access to all available API resources:

$apieraSdk = new \Apiera\Sdk\ApieraSdk($apieraConfig);

$categoryRequest = new \Apiera\Sdk\DTO\Request\Category\CategoryRequest(
    name: 'Hardware',
    store: '/api/v1/stores/520413a8-509a-4048-96e6-81751e315c5d',
    description: 'Some category description',
    parent: '/api/v1/stores/520413a8-509a-4048-96e6-81751e315c5d/categories/520413a8-509a-4048-96e6-81751e315c5d2'
);

$categoryResponse = $apieraSdk->category()->create($categoryRequest);

// Do something with $categoryResponse

More examples can be found here

Support

For support, please contact fredrik.tveraaen@apiera.io or visit our documentation.

License

This project is licensed under the MIT License - see the LICENSE file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-22