π Community-Driven PHP SDK for DeepSeek AI API Integration
- β¨ Features
- π¦ Installation
- π Quick Start
- π Migration Guide
- π Changelog
- π§ͺ Testing
- π Security
- π€ Contributors
- π License
- Seamless API Integration: PHP-first interface for DeepSeek's AI capabilities.
- Fluent Builder Pattern: Chainable methods for intuitive request building.
- Enterprise Ready: PSR-18 compliant HTTP client integration.
- Model Flexibility: Support for multiple DeepSeek models (Coder, Chat, etc.).
- Streaming Ready: Built-in support for real-time response handling.
- Many Http Clients: easy to use
Guzzle http client
(default) , orsymfony http client
. - Framework Friendly: Laravel & Symfony packages available.
Require the package via Composer:
composer require deepseek-php/deepseek-php-client
Requirements:
- PHP 8.1+
Get started with just two lines of code:
use DeepSeek\DeepSeekClient;
$response = DeepSeekClient::build('your-api-key')
->query('Explain quantum computing in simple terms')
->run();
echo $response;
π Defaults used:
- Model:
deepseek-chat
- Temperature: 0.8
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()
->setTemperature(1.2)
->query('Explain quantum computing in simple terms')
->run();
echo 'API Response:'.$response;
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"}]}
Function Calling allows the model to call external tools to enhance its capabilities.[1]
You Can check the documentation for function calling in FUNCTION-CALLING.md
Upgrading from v1.x? Check our comprehensive Migration Guide for breaking changes and upgrade instructions.
Detailed release notes available in CHANGELOG.md
./vendor/bin/pest
Test coverage coming in v2.1.
Click the button bellow or join here to be part of our growing community!
- π¨οΈ General - Daily chatter
- π‘ Ideas & Suggestions - Shape the community's future
- π’ Announcements & News - Official updates & news
- π Releases & Updates - Version tracking & migration support
- π Issues & Bug Reports - Collective problem-solving
- π€ Pull Requests - Code collaboration & reviews
Report Vulnerabilities: to omaralwi2010@gmail.com
A huge thank you to these amazing people who have contributed to this project! ππ
Omar AlAlwi π Creator |
Ayman Alhattami β Contributor |
Mohammad Asaad β Contributor |
Opada Alzaiede β Contributor |
Hisham Bin Ateya β Contributor |
Vinchan β Contributor |
Want to contribute? Check out the contributing guidelines and submit a pull request! π
This package is open-source software licensed under the MIT License.