developifynet/brightpearl-php

Brightpearl API 的 PHP 包装器

v1.0.2 2019-05-16 10:17 UTC

This package is auto-updated.

Last update: 2024-09-16 22:42:13 UTC


README

Build Status Total Downloads Latest Stable Version License

此包使用数组发送与您向 Brightpearl API 发送的相同的 JSON 请求。有关额外/可选字段信息,请参阅Brightpearl API 文档

安装

首先通过 Composer 引入该包。

composer require developifynet/brightpearl-php

使用方法

请注意,以下所有请求均适用于

基本(任何 PHP 应用程序)

use \Developifynet\Brightpearl\BrightpearlClient;

$client = new BrightpearlClient([
                'app_reference' => 'your-api-reference',
                'account_code'  => 'your-account',
                'account_token' => 'your-app-token',
                'api_domain'    => 'ws-eu1.brightpearl.com', // [optional], Provide URL or remove this line
            ]);
            
// or

$client = new BrightpearlClient();
$client->settings([
    'app_reference' => 'your-api-reference',
    'account_code'  => 'your-account',
    'account_token' => 'your-app-token',
    'api_domain'    => 'ws-eu1.brightpearl.com', // [optional], Provide URL or remove this line
]);

            
/**
 * Example Call
 * For more api calls check 'resources' folder
 */
$response = $client->getOrderStockStatus();

Laravel

$client = Brightpearl::settings([
                'app_reference' => 'your-api-reference',
                'account_code'  => 'your-account',
                'account_token' => 'your-app-token',
                'api_domain'    => 'ws-eu1.brightpearl.com', // [optional], Provide URL or remove this line
            ]);
/**
 * Example Calls
 * For more api calls check 'resources' folder
 */
$response = Brightpearl::getOrderStockStatus();             // Optional $ids,  e.g. '1' or '1-3,4,5'
$response = Brightpearl::getOrder();                        // Optional $ids,  e.g. '1' or '1-3,4,5'

服务

这些是由服务配置文件使用 GuzzleHttp/Guzzle-Services 生成的 API 方法调用。对于

联系

getContact() - 获取联系人信息

// All Contacts
$contact = $client->getContact();

// Contact by idset
$contact = $client->getContact(['id' => '1-3,4,5']);

// get a specific contact by id
$contact = $client->getContact(['id' => '1']);

订单

getOrder() - 获取订单

// All Orders
$order = $client->getOrder();

// Order by id
$order = $client->getOrder('1');

// Orders by idset
$orders = $client->getOrder('1-3,4,5');

其他可用服务

// Order Types
$order_types = $client->getOrderType();             // Optional $ids,  e.g. '1' or '1-3,4,5'
// Product Prices
$product_prices = $client->getProductPrice();       // Optional $ids,  e.g. '1' or '1-3,4,5'
// Price Lists
$price_lists = $client->getPriceList();             // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Price Lists Urls
$price_list_urls = $client->optionsProductPrice();  // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Contacts Urls
$contact_urls = $client->optionsContact();          // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Orders Urls
$order_urls = $client->optionsOrder();              // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Orders Urls
$order_urls = $client->optionsOrder();              // Optional $ids,  e.g. '1' or '1-3,4,5'
// Order Statuses
$order_statuses = $client->getOrderStatus();
// Warehouses
$warehouses = $client->getWarehouse();
// Channels
$channels = $client->getChannel();
// Order Stock Statuses
$order_stock_statuses = $client->getOrderStockStatus();
// Order Shipping Statuses
$order_shipping_statuses = $client->getOrderShippingStatus();
// Order Types
$order_types = $client->getOrderType();

贡献

目前 API 覆盖范围仅代表 Brightpearl API 的数据获取部分。如果您想贡献,请在 develop 分支提交包含错误修复、附加资源/服务和新功能的拉取请求。谢谢!