sellerlegend/sellerlegend-sdk-php
Composer 安装命令:
composer require sellerlegend/sellerlegend-sdk-php
包简介
Official SellerLegend SDK for Laravel applications
README 文档
README
Synopsis
Official SellerLegend SDK for Laravel applications.
Requirements
php: ^7.1
ext-curl: *
ext-json: *
ext-zlib: *
Documentation
Postman
Access Request
Getting Started
License
The MIT License (MIT). Please see License File for more information.
Installation
The recommended way to install sellerlegend-sdk-php is through Composer:
composer require sellerlegend/sellerlegend-sdk-php
Service Provider
SellerLegend\SellerLegendServiceProvider::class
Publish Assets
$ php artisan vendor:publish --tag=sellerlegend
And that's it!
Quick Start
Get Authorization Code
To get an authorization code you only need client id and redirect path.
use SellerLegend\Http\Client;
$config = [
"client_id" => "CLIENT_ID",
"client_secret" => "CLIENT_SECRET",
"redirect" => "REDIRECT_PATH"
];
$client = new Client($config);
$request = $client->getAuthorizationCode('YOUR_STATE_HERE');
Get Access Token
To get access token you need to send the received auth code. The auth code is for one time use only.
$request = $client->getAccessToken($request->get("code"));
Instantiate the Client
Once you have your access_token or the refresh_token you only need one of these along with client credentials to instantiate the client.
use SellerLegend\Http\Client;
$config = [
"client_id" => "CLIENT_ID",
"client_secret" => "CLIENT_SECRET",
"refresh_token" => "REFRESH_TOKEN"
];
$client = new Client($config);
Refresh Access Token
You can refresh your access token when it expires by using the following method. The new access token will be in the request response.
$request = $client->refreshAccessToken();
Check Service Status
$request = $client->getServiceStatus();
{
"status": "Success",
"code": 200,
"message": "Active",
"path": "api\/service-status"
}
Get User Details
use SellerLegend\Http\UserClient;
$client = new UserClient($config);
$request = $client->getUser();
{
"id": 1xxxxx,
"name": "Fxxxxx Dxxxxx",
"email": "fdxxxxx@domain.co",
"status": "ACTIVE",
"active": 1
}
Get Accounts List
This method fetches list of all marketplaces connected on SellerLegend against the provided access_token
use SellerLegend\Http\UserClient;
$client = new UserClient($config);
$request = $client->getAccountsList();
[{
"id": 1xxxxx,
"account_title": "[ACCOUNT-TITLE]",
"country_code": "US",
"currency_code": "USD",
"timezone": "America\/Los_Angeles",
"marketplace": "ATVPDKIKX0DER",
"seller_id": "[SELLER-ID]"
}]
Get Connections List
This method returns a list of Amazon connections between SellerLegend and the Amazon Selling Partner API and the Amazon Advertising API. With connection token status and details about all connected marketplaces.
use SellerLegend\Http\UserClient;
$client = new UserClient($config);
$response = $client->getConnectionsList();
[{
"account_title": "MyAccountTitle (Europe)",
"seller_id": "<SELLER-ID>",
"region": "Europe",
"sp": {
"status": "CONNECTED",
"last_connected_at": "2023-03-26T06:58:53Z",
"last_refreshed_at": "2023-04-10T02:10:23Z",
"brand_analytics_access": true
},
"ppc": {
"status": "CONNECTED",
"last_connected_at": "2023-03-26T04:25:53Z",
"last_refreshed_at": "2023-04-10T02:10:23Z",
},
"marketplaces": {
"DE": {
"account_title": "MyAccountTitle 2 (ES)",
"country": "DE",
"marketplace_id": "A1RKKUPIHCS9HS",
"status": "ONBOARDED",
"account_updates": {
"orders_updated_at": "2023-04-01T00:10:53Z",
"products_updated_at": "2023-04-02T01:30:20Z",
"finances_updated_at": "2023-04-02T02:00:24Z",
"inventory_updated_at": "2023-04-02T03:50:43Z",
"ppc_updated_at": "2023-04-06T07:00:23Z"
}
},
"ES": {
"status": "NOT_STARTED_BY_USER"
}
}
}]
Once you've your account id you can start making report requests using that account id.
Example API Calls
Request Report
Request report method can accept product_sku, dps_date and/or last_updated_at parameters. See documentation for details.
The request report method returns report_id in response, which is a required parameter of other report calls.
use SellerLegend\Http\ReportsClient;
$client = new ReportsClient($config);
$data = [
'account_id' => '1xxxxx',
'dps_date' => '2020-07-01'
];
$response = $client->requestReport($data);
{
"status": "Success",
"code": 200,
"message": "Request Submitted",
"path": "api\/report\/request",
"report_id": 7xxxxx
}
Get Report Status
This method is supposed to return a status from the list of possible statuses. See documentation for details.
$report_id = 7xxxxx;
$response = $client->getReportStatus($report_id);
{
"status": "working",
"code": 200,
"message": "Report Status",
"path": "api\/reports\/status",
"report_id": 7xxxxx
}
Get Report
Retrieves , delimited csv report content.
$report_id = 7xxxxx;
$response = $client->getReport($report_id);
Get Notifications List
This method accepts one of the SellerLegend registered notification types and responds with the list of notifications sent during the last 24 hours using zapier notification channel. See documentation for details.
use SellerLegend\Http\NotificationsClient;
$client = new NotificationsClient($config);
$notification_type = "Export Report";
$response = $client->getNotificationsList($notification_type);
[{
"id": 8xxx2,
"report_name": "US-COGS-20200827-080xxx.xlsx",
"type": "COGS",
"download_url": "https:\/\/app.sellerlegend.com\/reports\/download-report\/8xxx2",
"status": "done",
"requested_by": "Fxxxxx Dxxxxx",
"requested_at": "2020-08-27 08:54:36",
"completed_at": "2020-08-27 08:55:10"
}]
sellerlegend/sellerlegend-sdk-php 适用场景与选型建议
sellerlegend/sellerlegend-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 111 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 07 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「sl」 「sellerlegend」 「sellerlegend-sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sellerlegend/sellerlegend-sdk-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sellerlegend/sellerlegend-sdk-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sellerlegend/sellerlegend-sdk-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 111
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-30