adachsoft / web-content-fetch-moonshot
Moonshot AI implementation of adachsoft/web-content-fetch-contract for web content extraction.
Package info
gitlab.com/a.adach/web-content-fetch-moonshot
pkg:composer/adachsoft/web-content-fetch-moonshot
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.1
- friendsofphp/php-cs-fixer: ^3.95
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.3
- rector/rector: ^2.6
- symplify/phpstan-rules: ^14.17
- vlucas/phpdotenv: ^5.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-09-29 03:35:34 UTC
README
adachsoft/web-content-fetch-moonshot provides a Moonshot AI implementation of the adachsoft/web-content-fetch-contract web content fetching interface.
Features
- Fetches web page content through Moonshot AI.
- Implements
WebContentFetcherInterfacefrom the shared contract package. - Supports PSR-18 HTTP clients and PSR-17 request and stream factories.
- Validates API keys, URLs, and fetch options before sending requests.
- Allows custom Moonshot API base URLs and request timeouts.
Installation
composer require adachsoft/web-content-fetch-moonshot
Usage
use AdachSoft\WebContentFetchMoonshot\MoonshotWebContentFetcherFactory;
$factory = new MoonshotWebContentFetcherFactory();
$fetcher = $factory->create($_ENV['MOONSHOT_API_KEY']);
$content = $fetcher->fetchContent('https://example.com');
echo $content;
The API key must be provided by the application configuration. Do not commit credentials to source control.
Custom configuration
The factory accepts optional PSR-18 and PSR-17 implementations, a custom API base URL, and a request timeout:
$fetcher = $factory->create(
apiKey: $_ENV['MOONSHOT_API_KEY'],
baseUrl: 'https://api.moonshot.ai/v1',
timeoutSeconds: 30,
);
See the examples in docs/examples/ for additional usage guidance.
Requirements
- PHP 8.3 or newer
- A Moonshot API key