定制 codeswholesale-v3/sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

codeswholesale-v3/sdk

最新稳定版本:v1.4.3

Composer 安装命令:

composer require codeswholesale-v3/sdk

包简介

A PHP wrapper for CodesWholesale API v3

README 文档

README

🌍 Languages:
English | Česky

CodesWholesale PHP SDK

PHP SDK for working with the CodesWholesale API v3 (products, orders, license keys, synchronization, security).

Designed for real-world e‑commerce integrations and long-running background jobs.

✅ PHP 7.4+
✅ No framework required
✅ Automatic OAuth authentication
✅ Safe pagination (resume using continuation token)
✅ Designed for long-running syncs and cron jobs

Support This Project ❤️

This project is free and open-source and will always remain so.

If it helps you save time or ship faster, you can support ongoing maintenance via GitHub Sponsors:

➡️ https://github.com/sponsors/fefrik

Thank you — even a small contribution keeps the project going! 🚀

Requirements

  • PHP 7.4+
  • cURL extension
  • JSON extension

Installation

composer require codeswholesale-v3/sdk

Basic Usage

Creating the Client and SDK

use CodesWholesaleApi\Api\Client;
use CodesWholesaleApi\Config\Config;
use CodesWholesaleApi\Sdk;

$oauthStorage = new FileStorage(__DIR__ . '/oauth_token.json');

$client = new Client(
    new Config('https://api.codeswholesale.com'),
    $oauthStorage,
    'CLIENT_ID',
    'CLIENT_SECRET'
);

$sdk = new Sdk($client);

Architecture Overview

Client
 └── Endpoint (Products, Orders, Codes, …)
       └── Resource (ProductItem, OrderItem, …)

Client

  • Handles HTTP communication, OAuth2, retries, and errors
  • Always returns stdClass

Endpoint

  • Represents a REST API group (/v3/products, /v3/orders, …)
  • Converts responses into Resource objects

Resource

  • Immutable DTO (read‑only)
  • Typed getters
  • No business logic

SDK Contents (by API area)

Products

  • List products (paged, resumable)
  • Fetch product details
  • Fetch product descriptions
  • Fetch product images
  • Safe synchronization for large catalogs (50k+ products)

Orders

  • Create orders
  • Fetch order history
  • Fetch order details
  • Extract license keys from completed orders

Codes (License Keys)

  • Fetch ordered license keys
  • Download text or image-based codes
  • Base64 image handling

Account

  • Fetch account balance
  • Fetch account details

Security

  • Fraud / risk checks
  • IP and domain reputation
  • Risk score evaluation

Metadata

  • Platforms
  • Regions
  • Languages
  • Territories

Products

Fetching a single page of products

$page = $sdk->products()->getPage([
    'updatedSince' => '2024-01-01T00:00:00Z'
]);

foreach ($page['items'] as $product) {
    echo $product->getName();
}

Iterating over all products

$sdk->products()->getAll(
    function (array $items) {
        foreach ($items as $product) {
            saveProduct($product);
        }
    }
);

Product Synchronization (recommended)

Safe and resumable synchronization using continuation tokens.

$runner->runForSeconds(
    fn(ProductItem $p) => upsertProduct($p),
    30
);

✔ Safe for web requests
✔ Safe for cron jobs
✔ Continues exactly where it stopped

Disclaimer

This is a community-maintained integration and not an official CodesWholesale product.

You must use your own CodesWholesale API key and account. All trademarks belong to their respective owners.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-only
  • 更新时间: 2025-12-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固