adachsoft / web-content-fetch-deepseek
DeepSeek Fetch API implementation of adachsoft/web-content-fetch-contract for extracting web content.
Package info
gitlab.com/a.adach/web-content-fetch-deepseek
pkg:composer/adachsoft/web-content-fetch-deepseek
Requires
- php: >=8.3
- adachsoft/web-content-fetch-contract: ^0.1
- guzzlehttp/guzzle: ^7.8
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- adachsoft/php-code-style: ^0.7.2
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^11.0 || ^12.0
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
- vlucas/phpdotenv: ^5.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-11-11 05:26:42 UTC
README
adachsoft/web-content-fetch-deepseek implements the adachsoft/web-content-fetch-contract interface using the DeepSeek Fetch API.
Installation
composer require adachsoft/web-content-fetch-deepseek
The package includes Guzzle as its default PSR-18 HTTP client and PSR-17 request and stream factories. You can provide your own PSR-18 and PSR-17 implementations through the factory.
Usage
use AdachSoft\WebContentFetchDeepseek\Factory\DeepseekWebContentFetcherFactory;
$fetcher = (new DeepseekWebContentFetcherFactory())->create('your-deepseek-api-key');
$content = $fetcher->fetchContent('https://example.com');
The factory sends requests to https://api.deepseek.com/v1/tools/fetch by default. A custom API base URL can be supplied with BaseUrlVo.
The only supported per-request option is a positive integer timeout, in seconds:
$content = $fetcher->fetchContent('https://example.com', ['timeout' => 30]);
Unsupported options and invalid URLs raise exceptions from adachsoft/web-content-fetch-contract. Invalid API keys and base URLs raise InvalidApiKeyException and InvalidBaseUrlException, respectively.
Configuration
The API key is passed explicitly to the factory; the production package does not read environment variables or configuration files. For local end-to-end testing, copy .env.example to .env and set DEEPSEEK_API_KEY.
Testing
Run the unit and integration tests with:
vendor/bin/phpunit
The real-API test belongs to the production group and can be run with:
vendor/bin/phpunit --group production tests
The production test is skipped when DEEPSEEK_API_KEY is not configured in the environment or .env file.