PHPackages                             ecomphp/shopee-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ecomphp/shopee-php

ActiveLibrary[API Development](/categories/api)

ecomphp/shopee-php
==================

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

v1.8.0(1mo ago)969.7k↓65.7%19[4 issues](https://github.com/EcomPHP/shopee-php/issues)[1 PRs](https://github.com/EcomPHP/shopee-php/pulls)Apache-2.0PHPPHP ^7.2|^8.0CI passing

Since Nov 20Pushed 3d ago2 watchersCompare

[ Source](https://github.com/EcomPHP/shopee-php)[ Packagist](https://packagist.org/packages/ecomphp/shopee-php)[ RSS](/packages/ecomphp-shopee-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)Dependencies (8)Versions (40)Used By (0)

Shopee API PHP SDK — Modern PHP Client for Shopee Open Platform v2
==================================================================

[](#shopee-api-php-sdk--modern-php-client-for-shopee-open-platform-v2)

[![Total Downloads](https://camo.githubusercontent.com/d1ab187e4bfc05999049367f56f5195c007c3ebb2de77b1d73587ebf185a07fb/68747470733a2f2f706f7365722e707567782e6f72672f65636f6d7068702f73686f7065652d7068702f646f776e6c6f616473)](https://packagist.org/packages/ecomphp/shopee-php)[![Latest Stable Version](https://camo.githubusercontent.com/30240b4048a80b925ed5d9da47d2db7327b4b5bcb446cb1e88f0a6dc7c261a7b/68747470733a2f2f706f7365722e707567782e6f72672f65636f6d7068702f73686f7065652d7068702f762f737461626c65)](https://packagist.org/packages/ecomphp/shopee-php)[![Latest Unstable Version](https://camo.githubusercontent.com/6a740161443bb9c257dff8a0a7b0a0d1fd89bef53f8feadd19a87f237e0ae236/68747470733a2f2f706f7365722e707567782e6f72672f65636f6d7068702f73686f7065652d7068702f762f756e737461626c65)](https://packagist.org/packages/ecomphp/shopee-php)[![Build Status](https://camo.githubusercontent.com/9bfda415d6ee7b664d25c303e64624d18e698fc94bac41f868447a049e38b8b8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f65636f6d7068702f73686f7065652d7068702f63692e796d6c3f6272616e63683d6d6173746572266c6162656c3d63692532306275696c64267374796c653d666c61742d737175617265)](https://github.com/ecomphp/shopee-php/actions?query=workflow%3ATest)[![License](https://camo.githubusercontent.com/410466ea2117b328da95fc58525560eb7386f3cba16ff7548a9ae36a3ba57239/68747470733a2f2f706f7365722e707567782e6f72672f65636f6d7068702f73686f7065652d7068702f6c6963656e7365)](https://packagist.org/packages/ecomphp/shopee-php)

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

Easily manage Shopee OAuth2 authentication, automate access token generation, sync products, and fetch orders with minimal configuration.

---

📦 Installation
--------------

[](#-installation)

Install the **Shopee PHP Client** via [Composer](https://getcomposer.org/):

```
composer require ecomphp/shopee-php
```

---

🛠️ Configuration &amp; Setup
----------------------------

[](#️-configuration--setup)

Initialize the **Shopee Client** using your partner credentials provided by the Shopee Open Platform Console:

```
use EcomPHP\Shopee\Client;

$partner_id = 'your_partner_id_here';
$partner_key = 'your_partner_key_here';

$client = new Client($partner_id, $partner_key);
```

---

🔐 Shopee API OAuth2 Authentication (Grant Token)
------------------------------------------------

[](#-shopee-api-oauth2-authentication-grant-token)

The SDK provides a dedicated `Auth` class to seamlessly handle Shopee's OAuth2 login mechanism, access tokens, and refresh tokens.

```
$auth = $client->auth();
```

### Step 1: Create the Authentication Request URL

[](#step-1-create-the-authentication-request-url)

Generate the authorization redirect URL for the shop owner to grant permissions:

```
$redirect_uri = 'http://your-redirect-url.com';

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

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

### Step 2: Handle Redirect Callback &amp; Fetch Access Token

[](#step-2-handle-redirect-callback--fetch-access-token)

Once authorized, Shopee redirects the user back to your `Redirect URI` with an authorization code. Exchange it for your API tokens:

```
$authorization_code = $_GET['code'];
$shop_id = $_GET['shop_id'];

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

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

// IMPORTANT: Save your access_token, refresh_token & shop_id to your database for later use
```

### Step 3: Set Authorized Shop Credentials

[](#step-3-set-authorized-shop-credentials)

To make authorized calls on behalf of a specific shop, attach the token to your client instance:

```
$access_token = 'your_stored_access_token';
$shop_id = 'your_stored_shop_id';

$client->setAccessToken($shop_id, $access_token);
```

---

🔄 Refreshing Expired Access Tokens
----------------------------------

[](#-refreshing-expired-access-tokens)

Shopee access tokens expire quickly. Automate token renewal using your persistent `refresh_token`:

```
$new_token = $auth->refreshNewToken($refresh_token, $shop_id);

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

---

🚀 Shopee API Usage Examples
---------------------------

[](#-shopee-api-usage-examples)

> **Note:** A valid `access_token` and `shop_id` are required to interact with store-level data.

### 1. Get Product Item List

[](#1-get-product-item-list)

Fetch product details and stock information from your store. Refer to the official [Shopee Product API Document](https://open.shopee.com/documents/v2/v2.product.get_item_list?module=89&type=1).

```
$products = $client->Product->getItemList([
    'offset' => 0,
    'page_size' => 50,
    'item_status' => 'NORMAL',
]);
```

### 2. Get Order List &amp; Order Management

[](#2-get-order-list--order-management)

Retrieve recent sales and pending orders. Refer to the official [Shopee Order API Document](https://open.shopee.com/documents/v2/v2.order.get_order_list?module=94&type=1).

```
$orders = $client->Order->getOrderList([
    'order_status' => 'READY_TO_SHIP',
    'page_size' => 50,
]);
```

---

🤝 Contributing
--------------

[](#-contributing)

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

📄 License
---------

[](#-license)

This project is open-source software licensed under the [Apache License 2.0](LICENSE).

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance96

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~36 days

Recently: every ~23 days

Total

38

Last Release

31d ago

Major Versions

v0.4.0 → v1.0.02024-05-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/54855446?v=4)[nVuln](/maintainers/nVuln)[@nVuln](https://github.com/nVuln)

---

Top Contributors

[![Lishijie0](https://avatars.githubusercontent.com/u/51392302?v=4)](https://github.com/Lishijie0 "Lishijie0 (2 commits)")[![nVuln](https://avatars.githubusercontent.com/u/54855446?v=4)](https://github.com/nVuln "nVuln (2 commits)")[![arffsaad](https://avatars.githubusercontent.com/u/80538339?v=4)](https://github.com/arffsaad "arffsaad (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![zt-pro](https://avatars.githubusercontent.com/u/21299738?v=4)](https://github.com/zt-pro "zt-pro (1 commits)")

---

Tags

shopeeshopee-apishopee-partners-apishopee-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ecomphp-shopee-php/health.svg)

```
[![Health](https://phpackages.com/badges/ecomphp-shopee-php/health.svg)](https://phpackages.com/packages/ecomphp-shopee-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k832.6k54](/packages/neuron-core-neuron-ai)[files.com/files-php-sdk

Files.com PHP SDK

2482.9k](/packages/filescom-files-php-sdk)[volcengine/volcengine-php-sdk

119.5k](/packages/volcengine-volcengine-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
