Skip to content

⚡️ supercharged community-maintained PHP API client that allows you to interact with deepseek API

License

Notifications You must be signed in to change notification settings

alek-s-andr/deepseek-php-client

 
 

Repository files navigation

DeepSeek PHP Client

🚀 Community-Driven PHP SDK for DeepSeek AI API Integration

Latest Version PHP Version License Tests Status

Table of Contents


✨ Features

  • 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
  • Function Calling: Allows the model to call external tools to enhance its capabilities
  • Framework Friendly: Laravel & Symfony packages available

📦 Installation

Require the package via Composer:

composer require deepseek-php/deepseek-php-client

Requirements:

  • PHP 8.1+

🚀 Quick Start

Basic Usage

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

Advanced Configuration

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

$response = DeepSeekClient::build('your-api-key')
    ->withBaseUrl('https://api.deepseek.com/v2')
    ->withModel(Models::CODER)
    ->withTemperature(1.2)
    ->run();

echo 'API Response:'.$response;

Function Calling

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

$response = DeepSeekClient::build('your-api-key')
    ->withModel(Models::CHAT)
    ->withTools([    
        [
            'type' => 'function',
            'function' => [
                'name' => 'get_weather',
                'description' => 'Get weather of an location, the user shoud supply a location first',
                'parameters' => [
                    'type' => 'object',
                    'properties' => [
                        'location' => [
                            'type' => 'string',
                            'description' => 'The city and state, e.g. San Francisco, CA',
                        ],
                    ],
                    'required' => ['location'],
                ],
            ],
        ],
    ])
    ->run();

echo 'API Response:'.$response;

🛠 Framework Integration


🚧 Migration Guide

Upgrading from v1.x? Check our comprehensive Migration Guide for breaking changes and upgrade instructions.


📝 Changelog

Detailed release notes available in CHANGELOG.md


🧪 Testing

composer test
OR
./vendor/bin/pest

Test coverage coming in v2.1.


🔒 Security

Report Vulnerabilities: to [email protected]


🤝 Contributors

A huge thank you to these amazing people who have contributed to this project! 🎉💖

Omar AlAlwi
Omar AlAlwi

🏆 Creator
Ayman Alhattami
Ayman Alhattami

⭐ Contributor
Mohammad Asaad
Mohammad Asaad

⭐ Contributor
Opada Alzaiede
Opada Alzaiede

⭐ Contributor
Hisham Abdullah
Hisham Abdullah

⭐ Contributor

Want to contribute? Check out the contributing guidelines and submit a pull request! 🚀


📄 License

This package is open-source software licensed under the MIT License.

About

⚡️ supercharged community-maintained PHP API client that allows you to interact with deepseek API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%