Download the PHP package humantone/humantone-php without Composer
On this page you can find all versions of the php package humantone/humantone-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download humantone/humantone-php
More information about humantone/humantone-php
Files in humantone/humantone-php
Package humantone-php
Short Description Official PHP SDK for the HumanTone API. Humanize AI-generated text and check AI likelihood.
License MIT
Homepage https://humantone.io
Informations about the package humantone-php
humantone/humantone-php
Official PHP SDK for HumanTone. Humanize AI-generated text and check AI likelihood from your PHP code. One API key, same credits you already use in the HumanTone web app.
Install
Requires PHP 8.2 or later.
Requirements
- PHP 8.2+
- A paid HumanTone plan with API access. Free trial accounts cannot use the API.
- An API key from app.humantone.io/settings/api.
Quickstart
The client also picks up HUMANTONE_API_KEY from the environment automatically:
What's included
The SDK exposes three methods that map 1:1 to the three HumanTone API endpoints.
$client->humanize(...)
Rewrites AI-generated text to sound more natural.
| Argument | Type | Default | Notes |
|---|---|---|---|
text |
string |
required | Min 30 words. Max depends on plan (Basic 750, Standard 1000, Pro 1500). |
level |
HumanizationLevel |
Standard |
Advanced and Extreme are English-only. |
outputFormat |
OutputFormat |
Text |
SDK default is Text even though the API default is Html. |
customInstructions |
?string |
null |
Free-form rewrite guidance. Max 1000 chars. |
Returns HumanizeResult with $text, $outputFormat, $creditsUsed, $requestId (nullable string).
$client->detect(string $text): DetectResult
Returns AI likelihood score 0-100. Higher means more AI-like patterns. Free, but limited to 30 calls per day per account (shared between the web app and the API).
$client->account->get(): AccountInfo
Returns plan, credit balance, and subscription status. Useful for checking remaining credits before a large batch.
Configuration
You can inject any PSR-18 HTTP client:
When you inject a non-Guzzle PSR-18 client, the SDK can no longer distinguish a transport-level timeout from a generic network failure. Both are surfaced as NetworkException. Configure timeouts on your injected client. Guzzle (the default) maps connect-phase timeouts and CURLE_OPERATION_TIMEDOUT to TimeoutException.
Error handling
All exceptions raised by the SDK extend HumanToneException. Catch specific subclasses for expected cases.
Every exception exposes:
getMessage(): stringgetStatusCode(): ?intgetRequestId(): ?stringgetErrorCode(): ?stringgetDetails(): ?arrayisRetryable(): bool
Specific exceptions add typed accessors: RateLimitException::getRetryAfterSeconds(): int, DailyLimitExceededException::getTimeToNextRenew(): ?int, InsufficientCreditsException::getRequiredCredits(): ?int and getAvailableCredits(): ?int.
Retry behavior
The SDK retries account.get() on network errors, 5xx, and 429 (up to 2 retries). POST methods (humanize, detect) do not retry on network or 5xx by default. Humanize debits credits, so a retried request risks double-billing. Set retryOnPost: true to opt in. 429 always retries on every method.
Retry-After headers are honored in both numeric (seconds) and HTTP-date formats.
Limits to remember
- Per-request word limit. Basic 750, Standard 1000, Pro 1500. Inputs must be at least 30 words.
- Credits. Humanize consumes 1 credit per 100 words. Account checks and AI likelihood checks do not consume credits.
- AI likelihood quota. 30 checks per day per account, shared between the HumanTone web app and any API or SDK usage. Resets at midnight UTC.
- API access. Included on all paid plans. Free trial accounts cannot use the API.
Links
- API docs: https://humantone.io/docs/api/
- MCP server: https://humantone.io/docs/mcp/
- Get an API key: https://app.humantone.io/settings/api
- Manage plan and credits: https://app.humantone.io/settings/plan, https://app.humantone.io/settings/credits
- Issues: https://github.com/humantone/humantone-php/issues
- Author email: [email protected]
- Product support: [email protected]
License
MIT. Copyright (c) HumanTone.
All versions of humantone-php with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^7.0
psr/http-client Version ^1.0
psr/http-message Version ^1.1 || ^2.0