Download the PHP package westng/doudian-sdk without Composer

On this page you can find all versions of the php package westng/doudian-sdk. 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 doudian-sdk

抖店 SDK

PHP Version

抖店(抖音电商)开放平台 PHP SDK,支持 710+ 个 API 接口,原生支持 Swoole 协程环境和连接池

✨ 特性

安装

Swoole 环境(可选)

如果在 Swoole 协程环境下使用,推荐安装协程 HTTP 客户端:

🏗️ SDK架构说明

本SDK采用分层架构设计,遵循单一职责原则:

核心组件

🚀 快速开始

1. 基础用法(推荐)

SDK 作为 Composer 包使用时,推荐由业务项目自行封装初始化逻辑。
本 SDK 不依赖 .env 作为运行时配置来源,也不假设系统里只存在单一应用配置。

1.1 多应用场景

在实际项目中,通常会同时管理多个抖店开放平台应用。推荐按应用维度创建 SDK 实例,而不是把配置写死在 SDK 内部:

如果你的项目里有统一配置中心、租户体系或应用工厂,建议在业务层封装 DouDianSdk 的实例创建与 token 管理。

2. 高级配置

🌊 Swoole 协程支持

SDK 从 v2.1.0 开始原生支持 Swoole 协程环境,智能适配不同的运行环境。

连接池策略

SDK 会自动检测环境,选择最优方案:

优先级 环境 策略 说明
1 Hyperf + PoolHandler 直接使用 Hyperf 连接池 最优方案,充分利用 Hyperf
2 Hyperf + CoroutineHandler SDK 连接池 + Hyperf 协程 兼容方案
3 原生 Swoole SDK 连接池 兜底方案
4 PHP-FPM 进程级单例 传统模式

解决的问题

问题 之前 现在
Too many open files 每个协程创建独立连接,连接数无限增长 连接池限制最大连接数
连接泄漏 协程结束时连接未正确释放 请求完成立即归还,finally 保证
TCP 握手开销 每次请求都要握手 连接复用,减少握手
资源不可控 无法限制连接数 可配置最大连接数

连接池架构

连接池工作流程

Swoole 环境配置

队列消费者示例

连接池监控

资源释放

Hyperf 框架集成(推荐)

Hyperf 用户可以获得最佳性能,SDK 会自动使用 Hyperf 的 PoolHandler:

检查是否使用了 Hyperf PoolHandler:

环境检测

🔑 令牌管理

🛡️ 错误处理

📁 项目结构

🧪 测试

集成测试配置

注意:.env 仅用于本仓库自带测试,不是 SDK 正常接入方式。业务项目中请直接在代码里初始化 DouDianSdk,并自行管理 app_keyapp_secretaccess_token

  1. 复制 .env.example.env
  2. 配置基础凭证:

  3. 确保服务器 IP 已加入抖店开放平台白名单

商品相关测试数据

商品相关集成测试默认直接读取 tests/fixtures/ 下的 JSON 文件,不再依赖 .env 传 Step3 / Step4 的业务参数:

当前测试结构:

说明:

常用测试命令

🔧 重新导入官方 API 文件后的处理

如果你用官方最新 SDK 文件替换了 src/Api/,可以直接运行:

或使用 Makefile:

这个脚本只处理 src/Api/ 目录,用于补齐缺失的 namespace,并修复常见的客户端/配置类引用。

注意事项

  1. 访问令牌管理: 建议使用缓存存储访问令牌
  2. IP白名单: 确保服务器IP已添加到抖店开放平台白名单
  3. 频率限制: 遵守抖店开放平台的API调用频率限制
  4. Swoole 环境: 推荐安装 hyperf/guzzle 获得最佳连接池支持
  5. 连接池调优: 根据 getPoolStats() 返回的数据调整连接池大小

许可证

MIT License - 查看 LICENSE 文件了解详情。

联系方式


All versions of doudian-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.0
guzzlehttp/guzzle Version ^6.0|^7.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 westng/doudian-sdk contains the following files

Loading the files please wait ...