PHPackages                             ndkode/marketplace-integrator - 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. ndkode/marketplace-integrator

ActiveLibrary[API Development](/categories/api)

ndkode/marketplace-integrator
=============================

Unified Marketplace Integration for Laravel — TikTok Shop, Shopee, Lazada

01PHP

Since Apr 13Pushed 1mo agoCompare

[ Source](https://github.com/ndkode/marketplace-integrator)[ Packagist](https://packagist.org/packages/ndkode/marketplace-integrator)[ RSS](/packages/ndkode-marketplace-integrator/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Marketplace Integrator for Laravel
==================================

[](#marketplace-integrator-for-laravel)

Unified marketplace OAuth and credential management for **TikTok Shop**, **Shopee**, and **Lazada** in Laravel applications. The package stores **application credentials** (API keys, secrets, redirect URLs) separately from **shop records** (per-seller OAuth tokens), merges them for API calls, and ships with web UI routes, JSON API routes, and Blade views.

Requirements
------------

[](#requirements)

- PHP `^8.2`
- Laravel `^11`, `^12`, or `^13` (Illuminate components)
- Guzzle `^7`

Installation
------------

[](#installation)

```
composer require ndkode/marketplace-integrator
```

Laravel will auto-discover `Ndkode\MarketplaceIntegrator\Providers\MarketplaceServiceProvider`.

### Publish assets (optional)

[](#publish-assets-optional)

```
php artisan vendor:publish --tag=marketplace-integrator-config
php artisan vendor:publish --tag=marketplace-integrator-migrations
php artisan vendor:publish --tag=marketplace-integrator-views
```

Migrations are also loaded automatically from the package; publishing copies them into your app if you prefer to own the migration files.

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

Environment variables (see `config/marketplace-integrator.php` after publishing):

VariablePurpose`MARKETPLACE_TABLE_NAME`Credentials table (default: `marketplace_credentials`)`MARKETPLACE_SHOPS_TABLE_NAME`Shops table (default: `marketplace_shops`)`MARKETPLACE_ROUTE_PREFIX`Web UI prefix (default: `marketplace-integrator`)`MARKETPLACE_API_PREFIX`API prefix (default: `api/marketplace-integrator`)`TIKTOK_SHOP_BASE_URL`, `TIKTOK_SHOP_TOKEN_BASE_URL`, `TIKTOK_SHOP_AUTH_URL`TikTok Shop endpoints`SHOPEE_BASE_URL`Shopee Open Platform base URL (sandbox vs production)Lazada uses regional hosts derived from the `region` field on the credential (no separate `auth_url` in config).

### Credentials vs shops

[](#credentials-vs-shops)

- **Credential** — One row per marketplace app integration: app key/secret, **OAuth redirect URL**, and other app-level fields defined by each driver.
- **Shop** — Child rows under a credential: seller/shop identifiers and **access/refresh tokens** after OAuth.

For API calls, use `MarketplaceShop::toCredentialData()`, which merges the parent credential’s app fields with the shop’s tokens into a single `CredentialData` DTO.

### OAuth redirect URL

[](#oauth-redirect-url)

Configure the **redirect URL** in your marketplace developer console to match the package callback route, for example:

`https://your-domain.test/{web-prefix}/oauth/{marketplace}/callback`

where `{marketplace}` is `tiktok_shop`, `shopee`, or `lazada`. The same URL must be stored on the credential (per driver field definitions). If Shopee returns a callback **without** `state`, the package can resolve the pending credential from **session** (set when starting the redirect).

Routes
------

[](#routes)

**Web** (middleware from `config('marketplace-integrator.routes.middleware')`, default `web`):

- `GET/POST …/credentials` — CRUD for credentials (resource)
- Nested: `credentials/{credential}/shops/{shop}` — show, test, toggle active, destroy
- `GET …/oauth/{credential}/redirect` — start OAuth (`marketplace-integrator.oauth.redirect`)
- `GET …/oauth/{marketplace}/callback` — OAuth callback (`marketplace-integrator.oauth.callback`)

**API** (default `api` middleware, prefix `api/marketplace-integrator`):

- `GET marketplaces`, `GET marketplaces/{marketplace}/fields`
- `apiResource` for `credentials`
- Nested `credentials/{credential}/shops` — index, show, test, toggle, destroy

Route names are prefixed with `marketplace-integrator.` (web) and `api.marketplace-integrator.` (API).

Using drivers in code
---------------------

[](#using-drivers-in-code)

Resolve the manager and set merged credentials from a shop model:

```
use Ndkode\MarketplaceIntegrator\MarketplaceManager;
use Ndkode\MarketplaceIntegrator\Models\MarketplaceShop;

/** @var MarketplaceManager $marketplace */
$marketplace = app(MarketplaceManager::class);

$shop = MarketplaceShop::query()->with('credential')->findOrFail($id);

$driver = $marketplace->driver($shop->credential->marketplace);
$driver->setCredentials($shop->toCredentialData());

// Call driver methods as implemented per marketplace (authorize, refresh, test connection, etc.)
```

You may bind the `Marketplace` facade manually in `config/app.php` (or bootstrap) if you prefer `Marketplace::driver(...)` — the package registers the `marketplace` container alias for `MarketplaceManager`.

Events
------

[](#events)

EventWhen`Ndkode\MarketplaceIntegrator\Events\MarketplaceConnected`Shop connected / tokens stored`Ndkode\MarketplaceIntegrator\Events\MarketplaceDisconnected`Shop disconnected`Ndkode\MarketplaceIntegrator\Events\TokenRefreshed`Tokens refreshed`Ndkode\MarketplaceIntegrator\Events\CredentialsUpdated`Credential payload updatedPayloads use `MarketplaceShop` where applicable.

Custom drivers
--------------

[](#custom-drivers)

Implement `Ndkode\MarketplaceIntegrator\Contracts\MarketplaceDriverContract`, extend `AbstractMarketplaceDriver` if helpful, and register the class in `config('marketplace-integrator.drivers')`.

Development
-----------

[](#development)

```
composer install
./vendor/bin/pest
```

License
-------

[](#license)

MIT. See package metadata.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance59

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/38ae1fd62a3bb6996ed406d0309222b19212d159d4e260cfe454c8b35c8d6f73?d=identicon)[ndkode](/maintainers/ndkode)

---

Top Contributors

[![ndkode](https://avatars.githubusercontent.com/u/42101598?v=4)](https://github.com/ndkode "ndkode (1 commits)")

### Embed Badge

![Health badge](/badges/ndkode-marketplace-integrator/health.svg)

```
[![Health](https://phpackages.com/badges/ndkode-marketplace-integrator/health.svg)](https://phpackages.com/packages/ndkode-marketplace-integrator)
```

###  Alternatives

[facebook/php-business-sdk

PHP SDK for Facebook Business

90923.5M35](/packages/facebook-php-business-sdk)[exsyst/swagger

A php library to manipulate Swagger specifications

35916.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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