Skip to content

Latest commit

 

History

History
234 lines (177 loc) · 6.02 KB

README-CN.md

File metadata and controls

234 lines (177 loc) · 6.02 KB

DeepSeek PHP Client

🚀 社区驱动的 PHP SDK,用于 DeepSeek AI 接口集成

Latest Version PHP Version License Tests Status

EN | AR

目录


✨ 特性

  • 无缝 API 集成: DeepSeek AI 功能的 PHP 优先接口
  • 构建器模式: 直观的链接请求构建方法
  • 企业级别: 符合 PSR-18 规范
  • 模型灵活性: 支持多种 DeepSeek 模型(Coder、Chat 等)
  • 流式传输: 内置对实时响应处理的支持
  • 框架友好: 提供 Laravel 和 Symfony 包

📦 安装

通过 Composer 安装:

composer require deepseek-php/deepseek-php-client

要求:

  • PHP 8.1+

🚀 快速入门

基本用法

只需两行代码即可开始:

use DeepSeek\DeepSeekClient;

$response = DeepSeekClient::build('your-api-key')
    ->query('Explain quantum computing in simple terms')
    ->run();

echo $response;

📌 默认配置:

  • Model: deepseek-chat
  • Temperature: 0.8

Advanced Configuration

use DeepSeek\DeepSeekClient;
use DeepSeek\Enums\Models;

$client = DeepSeekClient::build(apiKey:'your-api-key', baseUrl:'https://api.deepseek.com/v3', timeout:30, clientType:'guzzle');

$response = $client
    ->withModel(Models::CODER->value)
    ->withStream()
    ->withTemperature(1.2)
    ->run();

echo 'API Response:'.$response;

Use with Symfony HttpClient

the package already built with symfony Http client, if you need to use package with symfony Http Client , it is easy to achieve that, just pass clientType:'symfony' with build function.

ex with symfony:

//  with defaults baseUrl and timeout
$client = DeepSeekClient::build('your-api-key', clientType:'symfony')
// with customization
$client = DeepSeekClient::build(apiKey:'your-api-key', baseUrl:'https://api.deepseek.com/v3', timeout:30, clientType:'symfony');

$client->query('Explain quantum computing in simple terms')
       ->run();

获取模型列表

use DeepSeek\DeepSeekClient;

$response = DeepSeekClient::build('your-api-key')
    ->getModelsList()
    ->run();

echo $response; // {"object":"list","data":[{"id":"deepseek-chat","object":"model","owned_by":"deepseek"},{"id":"deepseek-reasoner","object":"model","owned_by":"deepseek"}]}

🛠 框架集成


🚧 迁移指南

从 v1.x 升级?请查看我们全面的 迁移指南 了解重大变更和升级说明。


📝 更新日志

详细的发布说明可在 CHANGELOG.md 查看。


🧪 测试

./vendor/bin/pest

测试覆盖范围涵盖 v2.1。


🔒 安全

报告漏洞: [email protected]


🤝 贡献者

非常感谢为这个项目做出贡献的人! 🎉💖

Omar AlAlwi
Omar AlAlwi

🏆 Creator
Ayman Alhattami
Ayman Alhattami

⭐ Contributor
Mohammad Asaad
Mohammad Asaad

⭐ Contributor
Opada Alzaiede
Opada Alzaiede

⭐ Contributor
Hisham Bin Ateya
Hisham Bin Ateya

⭐ Contributor
陈文锋
陈文锋

⭐ Contributor

想要贡献? 查看 contributing guidelines 并提交拉取请求! 🚀


📄 许可

基于 MIT License 开源协议。