momentum / msg-online
此包已被弃用且不再维护。未建议替代包。
使用Marine Stores Guide API的官方SDK
0.0.19-alpha
2016-06-06 13:16 UTC
Requires
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is not auto-updated.
Last update: 2023-10-14 13:51:21 UTC
README
此SDK提供了一种API,您可以通过它查询Marine Stores Guide API。
要求
- 有效的开发者许可证和API密钥
安装
Composer
您可以通过Composer安装绑定
composer require momentum/msg-online
要使用绑定,请使用Composer的自动加载
require_once('vendor/autoload.php');
获取账户详情
这将返回认证用户的账户详情
require('vendor/autoload.php'); // Initialise the MSGOnline client with your API key \Momentum\MsgOnline\Client::setApiKey('%APIKEY%'); $user = new \Momentum\MSGOnline\User(); $user->getCurrentUser();
获取API版本详情
require('vendor/autoload.php'); // Initialise the MSGOnline client with your API key \Momentum\MsgOnline\Client::setApiKey('%APIKEY%'); $api = new \Momentum\MSGOnline\API(); $api->currentVersion();
获取所有产品
这将返回API中的所有产品
require('vendor/autoload.php'); // Initialise the MSGOnline client with your API key $client = new \Momentum\MsgOnline\Client('%APIKEY%'); $products = new \Momentum\MsgOnline\Products(); // List all products $products->all(); // Search the products API $products->search($keywords, $parameters = array()); // Get a product by its IMPA Code $products->getProductByCode($code);
搜索可用参数
category_id
限制产品到单个类别page
页码