destockage-habitat/sdk-php 问题修复 & 功能扩展

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

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

destockage-habitat/sdk-php

Composer 安装命令:

composer require destockage-habitat/sdk-php

包简介

Destockage Habitat API client to ease integration of our API

README 文档

README

Try the sdk with our example

  1. To see an example:
     git clone https://gitlab.com/destockage-habitat/sdk-php
     cd sdk-php
     composer install
    

    In your browser, access to the file examples.php.

Install

  1. In your project root repository run
     composer require destockage-habitat/sdk-php
    
  2. Install a http client of your choice, we recommend using GuzzleHttp 6 as the SDK embed an adapter for this client.
     composer require guzzlehttp/guzzle ^6.3
    

    You can also develop your own adapter, if you already have a http client library in your project (see the http adapter documentation for more information).

This will load the SDK library into the vendor repository.
And thanks to PSR-4 specification you should be able to access the SDK under the namespace \DestockageHabitat\Sdk.

Basic usage

Here are the three basic steps to use the SDK :

  1. Authentication to start a new session
  2. Retrieve the store(s) you want to manage from the session
  3. Manage resources

Authentication against the API

The Destockage-Habitat API requires that you are authenticated to perform any calls.

In order to make authenticated call, you should build the client like so:

<?php
namespace DestockageHabitat\Sdk;

// Setup credentials to connect to the API, and create session
$credential = new Credential\Token('api-token');
/** @var \DestockageHabitat\Sdk\Api\Session\SessionResource $session */
$session = Client\Client::createSession($credential);

Accessing your stores

/** @var \DestockageHabitat\Sdk\Api\Session\SessionResource $session */
$store = $session->getMainStore();
$store->getName(); // test-store
$store->getId(); // 1276
// ... and so on

If you manage more than one store, you can use the store collection object

/** @var \DestockageHabitat\Sdk\Api\Session\SessionResource $session */
// Get store collection
$stores = $session->getStores();
// Count the number of stores [int]
$stores->count();
// Get a particular store
$store = $stores->select('id-or-store-name');
// Loop over available stores
foreach ($stores as $store) {
	$store->getName(); 
}

SDK guides

SDK resources documentation

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2020-03-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固