定制 hiboutik/hiboutikapi 二次开发

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

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

hiboutik/hiboutikapi

最新稳定版本:v2.5.0

Composer 安装命令:

composer require hiboutik/hiboutikapi

包简介

Hiboutik API REST client

README 文档

README

This repository contains the open source PHP library that allows you to access the Hiboutik Platform from your PHP app.

Requirements

  • PHP 5.3.0 or newer
  • PHP cURL extension

Installation

Composer

The Hiboutik PHP library can be installed with Composer. Run this command:

composer require hiboutik/hiboutikapi

And in your script

<?php
require 'vendor/autoload.php';

Manual installation

Download this package and include the autoloader.

<?php

require 'HiboutikAPI/src/Hiboutik/autoloader.php';

Quick Documentation

There are two types of authentication available: basic and OAuth.

Basic authentication

$hiboutik = new \Hiboutik\HiboutikAPI(YOUR_HIBOUTIK_ACCOUNT, USER, KEY);

OAuth

$hiboutik = new \Hiboutik\HiboutikAPI(YOUR_HIBOUTIK_ACCOUNT);
$hiboutik->oauth(ACCESS_TOKEN);

Usage

To list all active products on your account:

$result = $hiboutik->get("/products/");
if ($hiboutik->request_ok) {
  print_r($result);
} else {
  if (isset($result['details']['error_description'])) {
    print $result['details']['error_description'];
  } else {
    print $result['error_description'];
  }
}

To create a new product:

$result = $hiboutik->post("products", [
  "product_model" => "My product",
  "product_barcode" => "",
  "product_brand" => "2",
  "product_supplier" => "2",
  "product_price" => "99.90",
  "product_discount_price" => "89.90",
  "product_category" => 5,
  "product_size_type" => 0,
  "product_stock_management" => 0,
  "product_supplier_reference" => "",
  "product_vat" => 0
]);

if ($hiboutik->request_ok) {
  print 'Product created!';
} else {
  if (isset($result['details']['error_description'])) {
    print $result['details']['error_description'];
  } else {
    print $result['error_description'];
  }
}

Pagination

The large datasets are paginated in the Hiboutik's API. Get the pagination information:

$pagination = $hiboutik->pagination();

Legacy support

For the scripts using the previous version of this package the old methods are still available. The only difference is in the addition of a parameter in the constructor. The API version must be specified for the v1:

$hiboutik = new \Hiboutik\HiboutikAPI(YOUR_HIBOUTIK_ACCOUNT, USER, KEY, '1');

统计信息

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

GitHub 信息

  • Stars: 12
  • Watchers: 6
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2015-12-14