conduit / php-livex
Liv-Ex高级葡萄酒交易平台PHP API适配器
dev-master
2018-01-20 09:50 UTC
Requires
- php: ^5.5 || ^7.0
Requires (Dev)
- phpdocumentor/phpdocumentor: 2.*
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2024-09-30 01:37:48 UTC
README
一组用于轻松与Liv-Ex API交互的类,可由composer安装。
更多信息请见http://www.developers.liv-ex.com/。
重要限制
- 目前,仅实现了CellarView2功能。计划全面覆盖所有API。
功能路线图
- CellarView2(工作中,约50%测试覆盖率)
- LWIN API
- 物流API
- 经纪API
- 估值
- 直接市场访问/交易所集成
- 交易警报
- 我的账户API
依赖关系
- PHP 5.5.38或更高版本
- PHP cURL(通常包含在PHP中)
- Liv-Ex API凭证
- Composer
安装
- 运行
composer require conduit\php-livex:dev-master
- 运行
composer install
- 如果您尚未包含自动加载器,请包含它 -
require './vendor/autoload.php';
使用方法
注意: 在docs/api
中可找到HTML API类文档。
命名空间和组织
PHP-LivEx组织成一系列命名空间,与Liv-Ex开发者网站上的API类别紧密匹配。目前这些是
Conduit\LivEx\Logistics
Conduit\LivEx\LWIN
快速示例:获取所有CellarView条目
use \Conduit\LivEx\Logistics\CellarView2; use \Conduit\LivEx\Error; $cv = new CellarView2('<your api key>','<your api secret>','DEV'); $r = $cv->getAll(); if(Error::isError($r)) { $r->pretty(); return; } var_dump($r); // An array of CellarView items.
快速示例:通过子账户代码查找所有条目
use \Conduit\LivEx\Logistics\CellarView2; use \Conduit\LivEx\Error; $cv = new CellarView2('<your api key>','<your api secret>','DEV'); $r = $cv->findBySubAccount('subaccountcode'); if(Error::isError($r)) { $r->pretty(); return; } var_dump($r); // An array of CellarView items, attached to "subaccountcode".
快速示例:通过LWIN查找所有条目
use \Conduit\LivEx\Logistics\CellarView2; use \Conduit\LivEx\Error; $cv = new CellarView2('<your api key>','<your api secret>','DEV'); $r = $cv->findByLwin('100598920111200750'); if(Error::isError($r)) { $r->pretty(); return; } var_dump($r); // An array of CellarView items of type LWIN 100598920111200750
快速示例:通过买家参考查找所有条目
use \Conduit\LivEx\Logistics\CellarView2; use \Conduit\LivEx\Error; $cv = new CellarView2('<your api key>','<your api secret>','DEV'); $r = $cv->findByBuyerRef('buyer-ref'); if(Error::isError($r)) { $r->pretty(); return; } var_dump($r); // An array of CellarView items linked with buyer reference "buyer-ref"
单元测试
PHP-LivEx捆绑了PHPUnit测试和测试运行器。计划实现全面覆盖。
要运行测试套件,请确保已安装require-dev依赖项,然后运行composer run test
。
API文档生成器
要重新生成API文档,请使用PHPDocumentor运行composer run docs