Download the PHP package laraditz/shopee without Composer

On this page you can find all versions of the php package laraditz/shopee. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package shopee

Laravel Shopee

Latest Version on Packagist Total Downloads GitHub Tests Action Status

A comprehensive Laravel package for seamlessly integrating with the Shopee Open Platform API. This package provides an elegant, fluent interface for managing shops, products, orders, and payments on Shopee's marketplace.

Buy Me A Coffee

Installation

You can install the package via composer:

Before Starting

Configure your Shopee API credentials in your .env file (recommended) or publish and modify the config file.

(Optional) You can publish the config file via this command:

Publish and run the migrations to create the necessary database tables for storing shop data, access tokens, and API request logs.

Authorization Flow

To authorize a Shopee shop with your app:

  1. Visit Shopee Open Platform Console.
  2. On your App List, click Authorize link next to the Test/Live Partner_id. Alternatively, you can generate the authorization URL using the generateAuthorizationURL() method.
  3. Make sure the domain for authorized redirect URL already been whitelisted beforehand.
  4. Enter https://your-app-url/shopee/shops/authorized as the Redirect URL and click Next.
  5. Proceed to login using the seller account that you want to authorized to be use for the app.
  6. Shopee redirects back to https://your-app-url/shopee/shops/authorized.
  7. Package automatically handles the authorization code exchange and token storage.
  8. Shop is now ready for API calls.

Custom Redirect After Authorization

By default, the package renders a built-in success page after authorization. To redirect to your own URL instead, set SHOPEE_REDIRECT_URL in your .env:

On success, the package redirects to your URL with the following query parameters:

Parameter Description
shop_id Shopee shop ID
shop_name Shop display name
region Shop region (e.g. MY, SG)
access_token OAuth access token
refresh_token OAuth refresh token
expires_at Token expiry (ISO 8601)

On failure (e.g. token exchange error), the redirect includes:

Parameter Value
error token_failed
shop_id Shopee shop ID

Security: SHOPEE_REDIRECT_URL must be an exact absolute URL without query strings. Only requests carrying this exact value are honoured — any other value is silently discarded, preventing open redirect attacks. Use HTTPS in production as tokens are passed in the URL.

Available Services & Methods

Below is a list of all available methods in this SDK. For detailed usage, please refer to the Developer’s Guide and the API Reference. This package organizes Shopee API endpoints into logical services. Each method name corresponds to its respective API endpoint (converted from snake_case → camelCase), and all parameters follow the exact definitions provided in the API reference.

Note: All method parameters must be passed as named arguments, not positional arguments.

🔐 Authorization and Authentication Service auth()

Handles OAuth 2.0 authentication flow and token management.

Method Description Parameters
accessToken() Generate access token from authorization code entity_id, EntityType entity_type
refreshToken() Refresh access token before expiration (4 hours) ShopeeAccessToken shopeeAccessToken

🏪 Shop Service shop()

Manages shop information and authorization processes.

Method Description
generateAuthorizationURL() Generate authorization URL for shop authorization
getShopInfo() Retrieve comprehensive shop information and status

📦 Product Service product()

Comprehensive product and inventory management capabilities.

Method Description Parameters
getItemList() Retrieve paginated list of shop items with filters offset, page_size, item_status, update_time_from, update_time_to
getItemBaseInfo() Get basic product information including pricing and status item_id_list, need_tax_info, need_complaint_policy
getItemExtraInfo() Get extended product details like dimensions and attributes item_id_list
getModelList() Retrieve all variants/models for a specific product item_id
searchItem() Search products by name, SKU, or status with pagination item_name, item_sku, item_status, offset, page_size and more
updateStock() Update inventory levels for product variants in bulk item_id, stock_list
addItem() Create a new product listing on Shopee Refer to Shopee API Reference
updateItem() Update an existing product listing item_id and any fields to update - refer to Shopee API Reference
deleteItem() Delete a product listing item_id

🛒 Order Service order()

Handles order management and retrieval with detailed tracking information.

Method Description Parameters
getOrderList() Retrieve paginated orders within specified date range time_range_field, time_from, time_to, page_size, cursor and more
getOrderDetail() Get comprehensive order details by order serial number order_sn_list, request_order_status_pending, response_optional_fields

💰 Payment Service payment()

Manages payment and financial transaction details.

Method Description Parameters
getEscrowDetail() Retrieve detailed escrow and payment information for orders order_sn

↩️ Returns Service returns()

Retrieves buyer return and refund requests. Each call also syncs a lightweight record (status, negotiation/proof/compensation status, refund amount, currency and Shopee timestamps) into the shopee_returns table via the ShopeeReturn model. Buyer personal data is not stored.

Method Description Parameters
getReturnList() Retrieve paginated list of returns with filters page_no, page_size, create_time_from, create_time_to, update_time_from, update_time_to, status and more - refer to Shopee API Reference
getReturnDetail() Get detailed information of a return return_sn - refer to Shopee API Reference

Usage Examples

The package provides a fluent, chainable API interface. Access services by chaining the service name before calling the method.

Basic Usage

Multi-Shop Support

By default, the package uses SHOPEE_SHOP_ID from your .env file. For multi-shop applications, specify the shop ID per request:

Error Handling

Webhook Integration

This package provides comprehensive webhook support for real-time notifications from Shopee. Refer to Push Mecahnism documentation for more details.

Event Handling

Create listeners for webhook events to automatically process updates from Shopee:

Event Description
Laraditz\Shopee\Events\WebhookReceived Triggered when receiving push notifications from Shopee

Setting Up Webhooks

Configure Webhook URL: In your Shopee Open Platform dashboard, set the webhook URL to:

Create Event Listeners to Handle Webhook Data: Create a listener to process incoming data:

Register Event Listeners: Register listeners in your EventServiceProvider (Laravel 10 and below):

Multi-tenant / hardening options (opt-in)

None of these change default behaviour. Existing code keeps working unchanged.

Authorization URL with a custom redirect

With no argument the URL is built exactly as before (the shopee.shops.authorized route, plus SHOPEE_REDIRECT_URL when set). When $redirect is given it is sent as the redirect parameter exactly as passed (query string included), and the route and redirect_url logic is skipped.

Verifying Shopee push signatures

Returns true when $authorization (the Authorization header) equals hash_hmac('sha256', $url . '|' . $rawBody, partner_key), compared in constant time. $url is the full push URL registered with Shopee and $rawBody the unparsed request body. An empty header returns false.

ShopAuthorized event

Laraditz\Shopee\Events\ShopAuthorized is dispatched by auth()->accessToken() right after a shop's token is saved. It exposes public readonly ShopeeShop $shop and ShopeeAccessToken $accessToken.

Token encryption

Default false: tokens are stored as plaintext, exactly as before. When true, access_token and refresh_token are encrypted with Laravel's Crypt (so APP_KEY must stay stable) when written through the ShopeeAccessToken model. Reads work for plaintext rows, encrypted rows, and after the flag is switched off again. A published config file without this key behaves as false.

To encrypt rows that already exist, enable the flag and run:

It prints Encrypted N value(s). and is safe to run again (the second run reports 0). With the flag off it prints Enable shopee.encrypt_tokens first. and exits with code 1. Always write tokens through the Eloquent model; query-builder updates skip the cast.

Request log controls

Defaults keep today's behaviour: every API call is saved to shopee_requests unredacted. A published config file without the logging block behaves the same way.

Laravel's model:prune only auto-discovers models in app/Models, so package models are not pruned unless you schedule them yourself with --model=:

Artisan Commands

The package provides convenient Artisan commands for token management:

Automated Token Refresh

Since Shopee access tokens expire every 4 hours, it's recommended to schedule the refresh command to run automatically. Add this to your app/Console/Kernel.php:

Important: Without automatic refresh, expired tokens will require shop reauthorization and manual token generation.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of shopee with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package laraditz/shopee contains the following files

Loading the files please wait ...