bluefission / simpleclients
Simple client wrappers for Blue Fission provider integrations
Requires
- php: >=8.2
- ext-json: *
- bluefission/develation: ^1.3.39
- simplehtmldom/simplehtmldom: ^2.0@RC
Requires (Dev)
- phpunit/phpunit: ^11.5
Suggests
- bluefission/automata: Enables Automata-backed LLM provider clients such as OpenAIClient.
- gemini-api-php/client: Provide a Gemini SDK implementation when using GoogleGeminiClient without an injected test double.
This package is auto-updated.
Last update: 2026-08-09 02:25:20 UTC
README
SimpleClients is a small PHP client library for connecting to provider APIs through reusable, testable client classes. It favors Blue Fission conventions and uses DevElation (bluefission/develation) patterns where they keep configuration, service access, and response handling simple.
The package owns provider client boundaries: authentication input, endpoint configuration, request transport, response normalization, error shape, and deterministic test fixtures. Consumers should depend on these general client contracts instead of adding one-off provider code in application layers.
Features
SimpleClients currently offers connectors to the following services:
- AWS SigV4 signing
- Claude
- DuckDuckGo Search
- Gemini
- Google Search
- Grok
- IP API Geo Location
- Hugging Face
- MurfAI
- OCR providers
- OpenAI
- Open Weather
- Speech transcription providers
- Trello
- Video analysis providers
- WikiHow
- Wikipedia
- Wiki News
Installation
To install SimpleClients, use Composer:
composer require bluefission/simpleclients
Usage
Each service client is implemented as a class under the BlueFission\SimpleClients namespace. Below are some examples of how to use these clients.
Example: WikipediaClient
<?php require 'vendor/autoload.php'; use BlueFission\SimpleClients\WikipediaClient; $wikipedia = new WikipediaClient(); $summary = $wikipedia->getSummary('Artificial Intelligence'); echo $summary;
Example: WikiHowClient
<?php require 'vendor/autoload.php'; use BlueFission\SimpleClients\WikiHowClient; $wikihow = new WikiHowClient(); $results = $wikihow->search('How to make coffee'); print_r($results);
Example: OpenAIClient
<?php require 'vendor/autoload.php'; use BlueFission\SimpleClients\OpenAIClient; $openai = new OpenAIClient(); $response = $openai->complete('What is the capital of France?'); print_r($response);
Further Examples
Below is a brief overview of more clients and their methods.
WikipediaClient
getSummary(string $topic): string- Retrieves the summary of a given topic from Wikipedia.
WikiHowClient
search(string $query): array- Searches for articles on WikiHow based on the given query.
extractRating($searchResult): float- Extracts the rating from a search result.
getSteps(string $url): array- Retrieves the steps from a WikiHow article.
getStepsAsString(string $url): string- Retrieves the steps from a WikiHow article as a formatted string.
OpenAIClient
generate($input, $config = [], callable $callback = null)- Generates a response from OpenAI based on the input.
complete(string $input, $config = []): array- Retrieves GPT-3 completion based on the input.
chat(string $input, $config = []): array- Retrieves GPT-3.5 chat completion based on the input.
image(string $prompt, string $width = '256', string $height = '256'): array- Retrieves an image generated by OpenAI based on the prompt.
embeddings(string $input): array- Retrieves embeddings from the Ada model based on the input.
GoogleSearchClient
search(string $query): array- Searches Google using the Custom Search JSON API.
DuckDuckGoSearchClient
search(string $query): array- Searches DuckDuckGo and retrieves results.
Configuration
Client constructors accept credentials and optional transport/test doubles where supported. Environment helpers are used only as fallback configuration. Do not commit secrets; pass API keys through runtime configuration, environment variables, or secret-management layers outside this package.
Develation Usage Pattern
SimpleClients treats DevElation helpers as the preferred package surface for reusable client internals:
- Use
Arrfor response traversal, config merging, key checks, joins, and iterable transformations. - Use
Strfor provider names, endpoint normalization, prefix checks, pattern matching, and string cleanup. - Use
Valfor nullable, empty, truthy, and falsy checks around optional credentials and provider responses. - Use
BlueFission\Net\HTTPfor query strings, JSON encoding/decoding, URL parsing, path segment encoding, and header lines. - Use contract objects such as
ClientConfig,ClientRequest,ClientResponse, andClientCapabilitieswhen a workflow needs stable request, response, or capability shapes.
Provider clients may continue returning their current array or string shapes for compatibility, but new shared paths should prefer these primitives and contract objects before introducing raw arrays or standalone helper functions.
See SPEC.md, ARCHITECTURE.md, CLIENT_CONTRACTS.md, PROVIDER_EXTRACTION.md, and tests.md for package scope, client boundaries, reusable contract shapes, provider extraction gates, and validation commands.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss what you would like to change.
License
This project is licensed under the MIT License.