PHPackages                             mmnijas/deepseek - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mmnijas/deepseek

ActiveLibrary[API Development](/categories/api)

mmnijas/deepseek
================

A Laravel package for seamless integration with DeepSeek AI services, enabling efficient and scalable AI-powered functionalities such as natural language processing, data analysis, and automation through a simple and intuitive API wrapper.

0.0.5(1y ago)012MITPHPPHP ^8.0

Since Feb 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mmnijas/deepseek)[ Packagist](https://packagist.org/packages/mmnijas/deepseek)[ RSS](/packages/mmnijas-deepseek/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

DeepSeek Laravel Integration
============================

[](#deepseek-laravel-integration)

[![Latest Version](https://camo.githubusercontent.com/38ffc3840b10490faab2aa03ab668e2492c267b5500b79d9792731a47157ba4b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6d6e696a61732f646565707365656b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mmnijas/deepseek)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/a17454f42d7dda43d55ab47219d5cd0e52ab6e15e2f23b415d9fe9b4f6a56fff/68747470733a2f2f706f7365722e707567782e6f72672f6d6d6e696a61732f646565707365656b2f646f776e6c6f616473)](https://packagist.org/packages/mmnijas/deepseek/stats)[![Monthly Downloads](https://camo.githubusercontent.com/89dd7a7e9643cd7bd89f921d53dde89d642f45d709ebf31cce7f29b8c161b5b2/68747470733a2f2f706f7365722e707567782e6f72672f6d6d6e696a61732f646565707365656b2f642f6d6f6e74686c79)](https://packagist.org/packages/mmnijas/deepseek/stats)[![Daily Downloads](https://camo.githubusercontent.com/1ed8572ed7ac819063b3e3b1bfb32b3066b4f49b4a0dd47354fd43babf377488/68747470733a2f2f706f7365722e707567782e6f72672f6d6d6e696a61732f646565707365656b2f642f6461696c79)](https://packagist.org/packages/mmnijas/deepseek/stats)

A seamless integration package for DeepSeek API in Laravel applications. Easily interact with DeepSeek's AI capabilities through an expressive Laravel-friendly interface.

Features
--------

[](#features)

- 🚀 Simple facade-based API
- ⚡️ Guzzle HTTP client integration
- 🔧 Configurable through environment variables
- 📦 Out-of-the-box service provider
- 💬 Support for chat completions
- 🛠 Extensible architecture

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Laravel 9.x or 10.x
- GuzzleHTTP 7.x

Installation
------------

[](#installation)

1. Install via Composer:

```
composer require mmnijas/deepseek
```

2. Add your DeepSeek API key to `.env`:

```
DEEPSEEK_API_KEY=your-api-key-here
```

3. (Optional) Publish config file:

```
php artisan vendor:publish --tag=deepseek-config
```

Configuration
-------------

[](#configuration)

After publishing the config file (`config/deepseek.php`), you can customize:

```
return [
    'api_key' => env('DEEPSEEK_API_KEY'),    // Your API key
    'base_uri' => 'https://api.deepseek.com/v1', // API endpoint
    'model' => 'deepseek-chat',              // Default model
    'timeout' => 30,                         // Request timeout in seconds
];
```

Basic Usage
-----------

[](#basic-usage)

### 1. Using the Facade

[](#1-using-the-facade)

```
use Mmnijas\DeepSeek\Facades\DeepSeek;

$response = DeepSeek::chat([
    ['role' => 'user', 'content' => 'Hello, DeepSeek!']
]);

// Get the assistant's reply
echo $response['choices'][0]['message']['content'];
```

### 2. In a Controller

[](#2-in-a-controller)

```
use Mmnijas\DeepSeek\Facades\DeepSeek;
use Illuminate\Http\Request;

class ChatController extends Controller
{
    public function handle(Request $request)
    {
        $messages = [
            ['role' => 'user', 'content' => $request->input('message')]
        ];

        $response = DeepSeek::chat($messages);

        return response()->json([
            'reply' => $response['choices'][0]['message']['content']
        ]);
    }
}
```

### 3. Blade View Example

[](#3-blade-view-example)

```

    @csrf

    Ask DeepSeek

@isset($response)

    {{ $response['choices'][0]['message']['content'] }}

@endisset
```

### 4. Artisan Command

[](#4-artisan-command)

Create a command:

```
php artisan make:command AskDeepSeek
```

Implement:

```
use Mmnijas\DeepSeek\Facades\DeepSeek;

class AskDeepSeek extends Command
{
    protected $signature = 'ask:deepseek {question}';

    public function handle()
    {
        $response = DeepSeek::chat([
            ['role' => 'user', 'content' => $this->argument('question')]
        ]);

        $this->info($response['choices'][0]['message']['content']);
    }
}
```

Usage:

```
php artisan ask:deepseek "What is Laravel?"
```

Advanced Usage
--------------

[](#advanced-usage)

### Custom Parameters

[](#custom-parameters)

```
$response = DeepSeek::chat(
    messages: [
        ['role' => 'user', 'content' => 'Explain quantum computing in simple terms']
    ],
    params: [
        'temperature' => 0.7,
        'max_tokens' => 500,
        'top_p' => 1.0,
    ]
);
```

### Multiple Messages

[](#multiple-messages)

```
$messages = [
    ['role' => 'system', 'content' => 'You are a helpful assistant'],
    ['role' => 'user', 'content' => 'Who won the world series in 2020?'],
    ['role' => 'assistant', 'content' => 'The Los Angeles Dodgers won the World Series in 2020.'],
    ['role' => 'user', 'content' => 'Where was it played?']
];

$response = DeepSeek::chat($messages);
```

### Error Handling

[](#error-handling)

```
try {
    $response = DeepSeek::chat([...]);
} catch (\Exception $e) {
    // Handle API errors
    logger()->error('DeepSeek API Error: ' . $e->getMessage());
    return response()->json(['error' => 'Service unavailable'], 503);
}
```

Rate Limiting
-------------

[](#rate-limiting)

The DeepSeek API has rate limits. Implement Laravel's rate limiter in `AppServiceProvider`:

```
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Support\Facades\RateLimiter;

RateLimiter::for('deepseek', function ($job) {
    return Limit::perMinute(60); // Adjust based on your API plan
});
```

Testing
-------

[](#testing)

Add to your test case:

```
public function test_deepseek_integration()
{
    Http::fake([
        'api.deepseek.com/v1/chat/completions' => Http::response([
            'choices' => [
                ['message' => ['content' => 'Mocked response']]
            ]
        ], 200)
    ]);

    $response = DeepSeek::chat([
        ['role' => 'user', 'content' => 'Test message']
    ]);

    $this->assertEquals('Mocked response', $response['choices'][0]['message']['content']);
}
```

Security
--------

[](#security)

Always:

- 🔑 Keep your API key secret
- 🛡 Validate user input
- ⏱ Implement rate limiting
- 📝 Follow DeepSeek's API guidelines

Common Issues
-------------

[](#common-issues)

### Missing API Key

[](#missing-api-key)

**Error:** "DeepSeek API key not configured"
**Solution:** Verify `.env` contains `DEEPSEEK_API_KEY`

### Network Errors

[](#network-errors)

**Error:** "Could not connect to DeepSeek API"
**Solution:**

1. Check internet connection
2. Verify API endpoint in config
3. Review firewall settings

### Invalid Response Format

[](#invalid-response-format)

**Error:** "Undefined index choices"
**Solution:**

```
// Check for successful response first
if (isset($response['choices'])) {
    // Process response
}
```

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for recent changes.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md) for details.

Contributing
------------

[](#contributing)

Pull requests are welcome! Please follow PSR coding standards and include tests.

---

📧 **Support:** 🌐 **Documentation:**

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance42

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

464d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8189422?v=4)[Nijas M M](/maintainers/mmnijas)[@mmnijas](https://github.com/mmnijas)

---

Top Contributors

[![mmnijas](https://avatars.githubusercontent.com/u/8189422?v=4)](https://github.com/mmnijas "mmnijas (1 commits)")

---

Tags

phpapiclientsdkaiopenaiphp-sdknlpApi Wrappermachine learningllmartificial intelligencenatural language processingai apiapi integrationAI SDKdeepseekdeveloper-toolstext-generationphp-api-clientrest-clientgenerative-aideepseek-apideepseek-aiai-client-libraryphp-ai-integrationopenai-alternativeqwenai-programmingai-php

### Embed Badge

![Health badge](/badges/mmnijas-deepseek/health.svg)

```
[![Health](https://phpackages.com/badges/mmnijas-deepseek/health.svg)](https://phpackages.com/packages/mmnijas-deepseek)
```

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[qwen-php/qwen-php-client

robust and community-driven PHP SDK library for seamless integration with the qwen AI API, offering efficient access to advanced AI and data processing capabilities

213.2k1](/packages/qwen-php-qwen-php-client)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[grok-php/laravel

Seamlessly integrate Grok AI into Laravel applications with an elegant, developer-friendly package. Leverage powerful AI models for chat, automation, and NLP while maintaining Laravel's expressive simplicity.

1633.4k](/packages/grok-php-laravel)[grok-php/client

Grok PHP Client is a robust and community-driven PHP client library for seamless integration with Grok AI API, offering efficient access to advanced AI and data processing capabilities.

325.9k4](/packages/grok-php-client)[softcreatr/php-mistral-ai-sdk

A powerful and easy-to-use PHP SDK for the Mistral AI API, allowing seamless integration of advanced AI-powered features into your PHP projects.

1517.9k](/packages/softcreatr-php-mistral-ai-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
