codeswholesale-v3/sdk
Composer 安装命令:
composer require codeswholesale-v3/sdk
包简介
A PHP wrapper for CodesWholesale API v3
README 文档
README
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.
codeswholesale-v3/sdk 适用场景与选型建议
codeswholesale-v3/sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「games」 「codeswholesale」 「cd-keys」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codeswholesale-v3/sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codeswholesale-v3/sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codeswholesale-v3/sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP wrapper for CodesWholesale's API
Epic Games OAuth 2.0 Client Provider for The PHP League OAuth2-Client
A PSR-7 compatible library for making CRUD API endpoints
The CodesWholesale Extension Framework
Gerador de números aleatórios para jogos de loteria
PHP wrapper for the official Fortnite API.
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2025-12-31