lsv / food-market-integration-wrapper
sinqro 食品市场集成包装器
v1.0.1
2021-12-01 14:43 UTC
Requires
- php: >=8.0
- nyholm/psr7: ^1.4
- psr/http-client: ^1.0
- symfony/options-resolver: ^5.4 | ^6.0
- symfony/property-access: ^5.4 | ^6.0
- symfony/serializer: ^5.4 | ^6.0
Requires (Dev)
- php-http/mock-client: ^1.5
- phpunit/phpunit: ^9.5
- symfony/http-client: ^6.0
Suggests
- symfony/http-client: PSR18 HTTP client
This package is auto-updated.
Last update: 2024-08-29 05:50:33 UTC
README
PHP 包装器,用于 sinqro 食品市场集成
安装和基本使用
使用 composer 安装,需要 PHP >8.0
composer require lsv/food-market-integration-wrapper # Add a PSR 18 client, fx composer require symfony/http-client # If you add another PSR18 client, then look below on how to use other PSR 18 clients
认证使用
use Lsv\FoodMarketIntegration\Authenticate; use Lsv\FoodMarketIntegration\Request; $userAccessToken = 'your user access token'; $serverAccessToken = 'your server access token'; $authenticate = new Authenticate($userAccessToken, $serverAccessToken); Request\AbstractRequest::setAuthentication($authenticate); // Your requests
基本使用,以获取订单
use Lsv\FoodMarketIntegration\Request; $marketCodeIdentifier = 'your market code identifier'; $marketOrderIdentifier = 'order id'; $request = new Request\GetOrder($marketCodeIdentifier, $marketOrderIdentifier); $response = $request->request(); # Response is now an object of Response\Order
更多使用方法,请参见以下内容。
使用说明
认证
订单请求
销售点请求
使用其他 PSR18 HTTP 客户端
如果您不想使用 symfony/http-client 实现,可以轻松将其更改为其他实现。
您可以使用以下列表中的 http 客户端:此列表 - 这些都是 PSR18 http 客户端实现。
use Lsv\FoodMarketIntegration\Request; $client = $YourPSR18Client; Request\AbstractRequest::setHttpClient($client); // Your requests
待办事项
- 更容易实现 websocket 集成