diff --git a/MIGRATION.md b/MIGRATION.md
new file mode 100644
index 0000000..ccb5cb4
--- /dev/null
+++ b/MIGRATION.md
@@ -0,0 +1,31 @@
+# CHANGELOG
+
+## [2.x] - 2025-02-01
+
+If you are upgrading from a version `1.x` to `2.x`, please perform the following steps:
+
+### Breaking Changes
+
+### 1. Namespace Change
+- **Old Namespace:** `DeepseekPhp`
+- **New Namespace:** `DeepSeek`
+
+**Action Required:**
+Update all imports in your codebase.
+
+##### Replace:
+```php
+use DeepseekPhp\Someclass;
+```
+
+##### With:
+```php
+use DeepSeek\Someclass;
+```
+
+### Migration Guide
+1. Replace all occurrences of `DeepseekPhp` with `DeepSeek` in your code.
+3. Run tests to ensure everything works as expected.
+
+If you encounter issues, please refer to our documentation or open an issue on GitHub.
+
diff --git a/README.md b/README.md
index 6703567..a8311b9 100644
--- a/README.md
+++ b/README.md
@@ -1,150 +1,192 @@
-
-
-
+
DeepSeek PHP Client
+ ๐ Community-Driven PHP SDK for DeepSeek AI API Integration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-# Deepseek PHP Client
-
## Table of Contents
-- [Overview](#Overview)
- - [Features](#key-Features)
-- [Installation](#installation)
-- [Quick Start Guide](#quick-start-guide)
- - [Basic Usage](#basic-usage)
- - [Advanced Usage](#advanced-usage)
- - [Use With Frameworks](#use-with-frameworks)
-- [Testing](#testing)
-- [Contributors](#contributors-)
-- [License](#license)
+- [โจ Features](#-features)
+- [๐ฆ Installation](#-installation)
+- [๐ Quick Start](#-quick-start)
+ - [Basic Usage](#basic-usage)
+ - [Advanced Configuration](#advanced-configuration)
+ - [Framework Integration](#-framework-integration)
+- [๐ Migration Guide](#-migration-guide)
+- [๐ Changelog](#-changelog)
+- [๐งช Testing](#-testing)
+- [๐ Security](#-security)
+- [๐ค Contributors](#-contributors)
+- [๐ License](#-license)
---
-## Overview
-**Deepseek PHP Client** is a robust and community-driven PHP client library for seamless integration with the [Deepseek](https://www.deepseek.com/) API.
-### Key Features
-- **Easy Integration:** Simplifies interaction with the Deepseek API using a PHP client.
-- **Method Chaining:** Supports fluent method chaining for building requests.
-- **Customizable:** Allows setting different models, query roles, and streaming options.
-- **PSR-18 Compliance:** Utilizes PSR-18 HTTP client for making API requests.
+
+## โจ 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
+- **Framework Friendly**: Laravel & Symfony packages available
---
-## Installation
+## ๐ฆ Installation
-You can install the package via Composer:
+Require the package via Composer:
```bash
composer require deepseek-php/deepseek-php-client
```
-**Ensure your project meets the following requirements:**
-- PHP 8.1 or later
+**Requirements**:
+- PHP 8.1+
---
-## Quick Start Guide
+## ๐ Quick Start
### Basic Usage
-```php
-use DeepseekPhp\DeepseekClient;
+Get started with just two lines of code:
-$apiKey = 'your-api-key';
+```php
+use DeepSeek\DeepSeekClient;
-$response = DeepseekClient::build($apiKey)
- ->query('Hello Deepseek, how are you today?')
+$response = DeepSeekClient::build('your-api-key')
+ ->query('Explain quantum computing in simple terms')
->run();
-echo 'API Response:'.$response;
+echo $response; // "Quantum computing uses qubits to..."
```
-**Note**: in easy mode it will take defaults for all configs [Check Default Values](https://github.com/deepseek-php/deepseek-php-client/blob/master/src/Enums/Configs/DefaultConfigs.php)
+๐ Defaults used:
+- Model: `deepseek-chat`
+- Temperature: 0.8
-### Advanced Usage
+### Advanced Configuration
```php
-use DeepseekPhp\DeepseekClient;
-use DeepseekPhp\Enums\Queries\QueryRoles;
-use DeepseekPhp\Enums\Models;
+use DeepSeek\DeepSeekClient;
+use DeepSeek\Enums\Models;
-$apiKey = 'your-api-key';
-
-$response = DeepseekClient::build($apiKey, 'https://api.deepseek.com/v2', 500)
- ->query('System setup query', 'system')
- ->query('User input message', 'user')
- ->withModel(Models::CODER->value)
- ->setTemperature(1.5)
+$response = DeepSeekClient::build('your-api-key')
+ ->withBaseUrl('https://api.deepseek.com/v2')
+ ->withModel(Models::CODER)
+ ->withTemperature(1.2)
->run();
echo 'API Response:'.$response;
```
-## Use With Frameworks
+### ๐ Framework Integration
### [Laravel Deepseek Package](https://github.com/deepseek-php/deepseek-laravel)
+### [Symfony Deepseek Package](https://github.com/deepseek-php/deepseek-symfony)
+
+---
+
+## ๐ง Migration Guide
+
+Upgrading from v1.x? Check our comprehensive [Migration Guide](MIGRATION.md) for breaking changes and upgrade instructions.
+
+---
+
+## ๐ Changelog
+
+Detailed release notes available in [CHANGELOG.md](CHANGELOG.md)
+
---
-## Testing
+## ๐งช Testing
+
+```bash
+composer test
+```
+
+Test coverage coming in v2.1.
+
+---
-tests will come soon .
+## ๐ Security
-## Changelog
+**Report Vulnerabilities**: to [omaralwi2010@gmail.com](mailto:omaralwi2010@gmail.com)
-See [CHANGELOG](CHANGELOG.md) for recent changes.
+---
-## Contributors โจ
+## ๐ค Contributors
-Thanks to these wonderful people for contributing to this project! ๐
+A huge thank you to these amazing people who have contributed to this project! ๐๐
-Want to contribute? Check out the [contributing guidelines](./CONTRIBUTING.md) and submit a pull request! ๐
-
-## Security
+**Want to contribute?** Check out the [contributing guidelines](./CONTRIBUTING.md) and submit a pull request! ๐
-If you discover any security-related issues, please email creator : `omaralwi2010@gmail.com`.
+---
-## License
+## ๐ License
-The MIT License (MIT). See [LICENSE](LICENSE.md) for more information.
+This package is open-source software licensed under the [MIT License](LICENSE.md).
diff --git a/composer.json b/composer.json
index 2b23890..7e39749 100644
--- a/composer.json
+++ b/composer.json
@@ -3,48 +3,32 @@
"description": "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.",
"keywords": [
"deepseek",
- "deepseek-php-client",
- "deepseek-api",
- "DeepSeek-R1",
- "DeepSeek-R1-Zero",
- "php-deepseek",
- "deepseek-coder",
- "deepseek-chat",
- "deepseek-math",
- "deepseek-integration",
- "openai",
+ "ai",
"sdk",
- "codex",
- "GPT-3",
- "DALL-E",
"api",
+ "php",
"client",
- "deepseek-sdk",
+ "llm",
+ "nlp",
+ "openai",
+ "qwen",
+ "machine-learning",
"php-sdk",
- "php-ai",
- "ai-for-php",
"ai-sdk",
"ai-api",
- "natural",
- "language",
- "processing",
- "deepseek-php-library",
- "deepseek-client",
"natural-language-processing",
- "ai-integration",
- "machine-learning",
- "php-machine-learning",
- "php-iot",
- "nlp",
- "data-processing",
- "deep-learning",
- "deepseek-library",
- "php-library",
"api-integration",
"php-api-client",
"deepseek-ai",
- "php-openai-alternative",
- "ai-client-library"
+ "ai-client-library",
+ "text-generation",
+ "generative-ai",
+ "api-wrapper",
+ "rest-client",
+ "developer-tools",
+ "php-ai-integration",
+ "deepseek-api",
+ "openai-alternative"
],
"homepage": "https://github.com/deepseek-php/deepseek-php-client",
"license": "MIT",
@@ -61,7 +45,7 @@
"role": "creator"
}
],
- "version": "1.0.2",
+ "version": "2.0.0",
"require": {
"php": "^8.1.0",
"php-http/discovery": "^1.20.0",
@@ -86,12 +70,12 @@
},
"autoload": {
"psr-4": {
- "DeepseekPhp\\": "src/"
+ "DeepSeek\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
- "DeepseekPhp\\Tests\\": "tests/"
+ "DeepSeek\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
diff --git a/src/Contracts/DeepseekClientContract.php b/src/Contracts/DeepseekClientContract.php
index 0106b90..3e5316e 100644
--- a/src/Contracts/DeepseekClientContract.php
+++ b/src/Contracts/DeepseekClientContract.php
@@ -1,8 +1,8 @@
statusCode = $statusCode;
- return $this;
}
public function getStatusCode(): int
{
diff --git a/src/Models/SuccessResult.php b/src/Models/SuccessResult.php
index dd1a629..2cd0fd3 100644
--- a/src/Models/SuccessResult.php
+++ b/src/Models/SuccessResult.php
@@ -2,11 +2,10 @@
declare(strict_types=1);
-namespace DeepseekPhp\Models;
-
+namespace DeepSeek\Models;
class SuccessResult extends ResultAbstract
{
-
+
}
diff --git a/src/Resources/Chat.php b/src/Resources/Chat.php
index fe0ebda..1863a52 100644
--- a/src/Resources/Chat.php
+++ b/src/Resources/Chat.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace DeepseekPhp\Resources;
+namespace DeepSeek\Resources;
class Chat extends Resource
{
diff --git a/src/Resources/Coder.php b/src/Resources/Coder.php
index 2495c6f..412beed 100644
--- a/src/Resources/Coder.php
+++ b/src/Resources/Coder.php
@@ -2,9 +2,9 @@
declare(strict_types=1);
-namespace DeepseekPhp\Resources;
+namespace DeepSeek\Resources;
-use DeepseekPhp\Enums\Models;
+use DeepSeek\Enums\Models;
class Coder extends Resource
{
diff --git a/src/Resources/Resource.php b/src/Resources/Resource.php
index 51e1030..a3075cf 100644
--- a/src/Resources/Resource.php
+++ b/src/Resources/Resource.php
@@ -2,19 +2,19 @@
declare(strict_types=1);
-namespace DeepseekPhp\Resources;
-
-use DeepseekPhp\Contracts\Models\ResultContract;
-use DeepseekPhp\Contracts\Resources\ResourceContract;
-use DeepseekPhp\Enums\Configs\DefaultConfigs;
-use DeepseekPhp\Enums\Models;
-use DeepseekPhp\Enums\Data\DataTypes;
-use DeepseekPhp\Enums\Requests\EndpointSuffixes;
-use DeepseekPhp\Enums\Requests\QueryFlags;
-use DeepseekPhp\Models\BadResult;
-use DeepseekPhp\Models\FailureResult;
-use DeepseekPhp\Models\SuccessResult;
-use DeepseekPhp\Traits\Queries\HasQueryParams;
+namespace DeepSeek\Resources;
+
+use DeepSeek\Contracts\Models\ResultContract;
+use DeepSeek\Contracts\Resources\ResourceContract;
+use DeepSeek\Enums\Configs\DefaultConfigs;
+use DeepSeek\Enums\Models;
+use DeepSeek\Enums\Data\DataTypes;
+use DeepSeek\Enums\Requests\EndpointSuffixes;
+use DeepSeek\Enums\Requests\QueryFlags;
+use DeepSeek\Models\BadResult;
+use DeepSeek\Models\FailureResult;
+use DeepSeek\Models\SuccessResult;
+use DeepSeek\Traits\Queries\HasQueryParams;
use GuzzleHttp\Exception\BadResponseException;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Client\ClientInterface;
diff --git a/src/Traits/Queries/HasQueryParams.php b/src/Traits/Queries/HasQueryParams.php
index 453c7bb..bb2a1a8 100644
--- a/src/Traits/Queries/HasQueryParams.php
+++ b/src/Traits/Queries/HasQueryParams.php
@@ -1,9 +1,9 @@
value:
- return (string) $value;
- case DataTypes::INTEGER->value:
- return (int) $value;
- case DataTypes::FLOAT->value:
- return (float) $value;
- case DataTypes::ARRAY->value:
- return (array) $value;
- case DataTypes::OBJECT->value:
- return (object) $value;
- case DataTypes::BOOL->value:
- return (bool) $value;
- case DataTypes::JSON->value:
- return json_decode((string) $value, true);
- default:
- return $value;
- }
+ return match ($type) {
+ DataTypes::STRING->value => (string)$value,
+ DataTypes::INTEGER->value => (int)$value,
+ DataTypes::FLOAT->value => (float)$value,
+ DataTypes::ARRAY->value => (array)$value,
+ DataTypes::OBJECT->value => (object)$value,
+ DataTypes::BOOL->value => (bool)$value,
+ DataTypes::JSON->value => json_decode((string)$value, true),
+ default => $value,
+ };
}
/**
@@ -63,13 +55,10 @@ private function convertValue($value, string $type): mixed
*/
private function getDefaultForKey(string $key): mixed
{
- switch ($key) {
- case QueryFlags::MODEL->value:
- return $this->getDefaultModel();
- case QueryFlags::STREAM->value:
- return $this->getDefaultStream();
- default:
- return null;
- }
+ return match ($key) {
+ QueryFlags::MODEL->value => $this->getDefaultModel(),
+ QueryFlags::STREAM->value => $this->getDefaultStream(),
+ default => null,
+ };
}
}
diff --git a/src/Traits/Resources/HasChat.php b/src/Traits/Resources/HasChat.php
index 29ae330..2365ade 100644
--- a/src/Traits/Resources/HasChat.php
+++ b/src/Traits/Resources/HasChat.php
@@ -1,8 +1,8 @@
apiKey)
+ $deepseek = DeepSeekClient::build($this->apiKey)
->query('Hello Deepseek, how are you today?')
->setTemperature(1.5);
$response = $deepseek->run();
@@ -28,7 +28,7 @@ public function test_ok_response()
}
public function test_can_not_access_with_api_expired_payment()
{
- $deepseek = DeepseekClient::build($this->expiredApiKey)
+ $deepseek = DeepSeekClient::build($this->expiredApiKey)
->query('Hello Deepseek, how are you today?')
->setTemperature(1.5);
$response = $deepseek->run();
@@ -42,7 +42,7 @@ public function test_can_not_access_with_api_expired_payment()
}
public function test_access_with_wrong_api_key()
{
- $deepseek = DeepseekClient::build($this->apiKey."wrong-api-key")
+ $deepseek = DeepSeekClient::build($this->apiKey."wrong-api-key")
->query('Hello Deepseek, how are you today?')
->setTemperature(1.5);
$response = $deepseek->run();