承接 ecomphp/lazada-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ecomphp/lazada-php

Composer 安装命令:

composer require ecomphp/lazada-php

包简介

A powerful, lightweight, and developer-friendly Lazada API PHP SDK designed to integrate Lazada Open Platform into vanilla PHP applications, Laravel, or Symfony projects.

README 文档

README

Total Downloads Latest Stable Version Latest Unstable Version License

A powerful, lightweight, and developer-friendly Lazada API PHP SDK designed to integrate Lazada Open Platform into vanilla PHP applications, Laravel, or Symfony projects.

Easily manage Lazada OAuth authentication, automate access token generation, refresh tokens, sync products, fetch orders, and call seller APIs with minimal configuration.

📦 Installation

Install the Lazada PHP Client via Composer:

composer require ecomphp/lazada-php

🛠️ Configuration & Setup

Initialize the Lazada Client using your app credentials provided by the Lazada Open Platform Console:

use EcomPHP\Lazada\Client;

$app_key = 'your_app_key_here';
$app_secret = 'your_app_secret_here';
$callback_url = 'https://your-app.com/lazada/callback';

$client = new Client($app_key, $app_secret, $callback_url);

The SDK supports Lazada regions: vn, sg, my, th, ph, and id.

🔐 Lazada API OAuth Authentication

The SDK provides a dedicated Auth class to handle Lazada's OAuth authorization flow, access tokens, and refresh tokens.

$auth = $client->auth();

Step 1: Create the Authentication Request URL

Generate the authorization redirect URL for the seller to grant permissions:

$state = 'your-csrf-or-tracking-state';
$country = 'vn'; // Optional: vn, sg, my, th, ph, id

// Returns the Lazada authentication URL instead of auto-redirecting
$authUrl = $auth->createAuthRequest($state, $country, true);

// Redirect user to Lazada Authorization page
header('Location: ' . $authUrl);
exit;

Step 2: Handle Redirect Callback & Fetch Access Token

Once authorized, Lazada redirects the user back to your callback URL with an authorization code. Exchange it for your API tokens:

$authorization_code = $_GET['code'];

// Exchange code for Access Token & Refresh Token
$token = $auth->getToken($authorization_code);

$access_token = $token['access_token'];
$refresh_token = $token['refresh_token'];

// IMPORTANT: Save your access_token, refresh_token, and seller region to your database for later use

Step 3: Set Authorized Seller Credentials

To make authorized calls on behalf of a specific seller, attach the access token and region to your client instance:

$access_token = 'your_stored_access_token';
$region = 'vn';

$client->setAccessToken($access_token, $region);

🔄 Refreshing Expired Access Tokens

Lazada access tokens expire. Automate token renewal using your persistent refresh_token:

$new_token = $auth->refreshNewToken($refresh_token);

$new_access_token = $new_token['access_token'];
$new_refresh_token = $new_token['refresh_token'];

🚀 Lazada API Usage Examples

Note: A valid access_token and seller region are required to interact with seller-level data.

1. Get Product List

Fetch product information from your Lazada store:

$products = $client->Product->GetProducts([
    'offset' => 0,
    'limit' => 50,
    'filter' => 'all',
]);

2. Get Product Item

Retrieve a single product by Lazada item ID:

$product = $client->Product->GetProductItem('123456789');

3. Get Order List & Order Items

Retrieve recent orders and their order items:

$orders = $client->Order->GetOrders([
    'created_after' => '2026-07-01T00:00:00+0800',
    'status' => 'pending',
]);

$orderItems = $client->Order->GetOrderItems('123456789');

4. Update Order Status to Ready to Ship

Set order items as ready to ship:

$result = $client->Order->SetStatusToReadyToShip(
    ['123456789'],
    'Dropshipping Provider',
    'TRACKING_NUMBER'
);

🧩 Available API Resources

The client exposes Lazada API groups as resource properties, including:

  • System
  • Seller
  • Order
  • Finance
  • Product
  • ProductReview
  • StoreDecoration
  • MediaCenter
  • Flexicombo
  • SellerVoucher
  • FreeShipping
  • ReturnAndRefund
  • Fulfillment
  • Logistic
  • LazadaLogistics
  • Wallet
  • SponsoredSolutions
  • ServiceMarket
  • LazLive
  • Content

Example:

$categoryTree = $client->Product->GetCategoryTree();
$sellerInfo = $client->Seller->GetSeller();

🧪 Testing

Run the test suite with Composer:

composer test

🤝 Contributing

Contributions, feature suggestions, and bug reports for the ecomphp/lazada-php client are highly appreciated. Feel free to open issues or submit Pull Requests!

📄 License

This project is open-source software licensed under the Apache License 2.0.

ecomphp/lazada-php 适用场景与选型建议

ecomphp/lazada-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 129 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 12 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ecomphp/lazada-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ecomphp/lazada-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 ecomphp/lazada-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 129
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2023-12-25