shoppingfeed/php-sdk
Composer 安装命令:
composer require shoppingfeed/php-sdk
包简介
Shopping Feed SDK to ease integration of our API
README 文档
README
Install
- In your project root repository run
composer require shoppingfeed/php-sdk
- Install a http client of your choice, we recommend using GuzzleHttp 6 as the SDK embed an adapter for this client.
composer require guzzlehttp/guzzle ^6.3
You can also develop your own adapter, if you already have a http client library in your project (see the http adapter documentation for more information).
This will load the SDK library into the vendor repository.
And thanks to PSR-4 specification you should be able to access the SDK under the namespace \ShoppingFeed\Sdk.
Basic usage
Here are the three basic steps to use the SDK :
- Authentication to start a new session
- Retrieve the store(s) you want to manage from the session
- Manage resources
Authentication against the API
The Shopping Feed API requires that you are authenticated to perform any calls.
In order to make authenticated call, you should build the client like so:
<?php namespace ShoppingFeed\Sdk; // Setup credentials to connect to the API, and create session $credential = new Credential\Token('api-token'); /** @var \ShoppingFeed\Sdk\Api\Session\SessionResource $session */ $session = Client\Client::createSession($credential);
Accessing your stores
/** @var \ShoppingFeed\Sdk\Api\Session\SessionResource $session */ $store = $session->selectStore(1276); $store->getName(); // test-store $store->getId(); // 1276 // ... and so on
If you manage more than one store, you can use the store collection object
/** @var \ShoppingFeed\Sdk\Api\Session\SessionResource $session */ // Get store collection $stores = $session->getStores(); // Count the number of stores [int] $stores->count(); // Get a particular store $store = $stores->select('id-or-store-name'); // Loop over available stores foreach ($stores as $store) { $store->getName(); }
SDK guides
SDK resources documentation
Generates XML compliant feed for import
The SDK is able to simplify XML feed creation by providing necessary tools.
Check the documentation at https://github.com/shoppingflux/php-feed-generator to learn how to create compliant feed.
shoppingfeed/php-sdk 适用场景与选型建议
shoppingfeed/php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 231.17k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 shoppingfeed/php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shoppingfeed/php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 231.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 19
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-04-12