Official PHP SDK for the Scanii content processing API.
- Light. Zero runtime dependencies, stdlib only.
- Up to date. Always current with the latest Scanii API.
- Integration-only. Wraps the REST API — retries, concurrency, and batching are the caller's responsibility.
The only stdlib extensions required are ext-curl and ext-json, both shipped by default with every official PHP distribution (including the Windows builds).
composer require scanii/scanii-phpRequires PHP 8.4 or newer.
use Scanii\ScaniiClient;
$client = ScaniiClient::create('your-api-key', 'your-api-secret');
// Scan a file from disk:
$result = $client->process('/path/to/file');
echo implode(', ', $result->findings);ScaniiClient::create returns a thread-friendly client that you can reuse across requests; the constructor performs no I/O.
Pass any PHP stream resource — fopen(), tmpfile(), php://temp, etc.:
// From a temp file / in-memory stream:
$stream = fopen('php://temp', 'r+');
fwrite($stream, $content);
rewind($stream);
$result = $client->processStream($stream, 'upload.bin');
echo implode(', ', $result->findings);
fclose($stream);| Method | REST | Returns |
|---|---|---|
process($path, $metadata, $callback) |
POST /files |
ScaniiProcessingResult |
processStream($stream, $filename, $contentType, $metadata, $callback) |
POST /files |
ScaniiProcessingResult |
processAsync($path, $metadata, $callback) |
POST /files/async |
ScaniiPendingResult |
processAsyncStream($stream, $filename, $contentType, $metadata, $callback) |
POST /files/async |
ScaniiPendingResult |
processFromUrl($location, $callback, $metadata) |
POST /files |
ScaniiProcessingResult (v2.2 preview) |
fetch($location, $metadata, $callback) |
POST /files/fetch |
ScaniiPendingResult |
retrieve($id) |
GET /files/{id} |
ScaniiProcessingResult |
retrieveTrace($id) |
GET /files/{id}/trace |
?ScaniiTraceResult (v2.2 preview) |
ping() |
GET /ping |
bool |
createAuthToken($timeoutSeconds) |
POST /auth/tokens |
ScaniiAuthToken |
retrieveAuthToken($id) |
GET /auth/tokens/{id} |
ScaniiAuthToken |
deleteAuthToken($id) |
DELETE /auth/tokens/{id} |
void |
retrieveAccountInfo() |
GET /account.json |
ScaniiAccountInfo |
Full API reference: https://scanii.github.io/openapi/v22/.
| Constant | Endpoint |
|---|---|
ScaniiTarget::AUTO |
https://api.scanii.com |
ScaniiTarget::US1 |
https://api-us1.scanii.com |
ScaniiTarget::EU1 |
https://api-eu1.scanii.com |
ScaniiTarget::EU2 |
https://api-eu2.scanii.com |
ScaniiTarget::AP1 |
https://api-ap1.scanii.com |
ScaniiTarget::AP2 |
https://api-ap2.scanii.com |
ScaniiTarget::CA1 |
https://api-ca1.scanii.com |
Pass any string URL for a custom or local endpoint:
$client = ScaniiClient::create('key', 'secret', 'http://localhost:4000');Run the integration tests against a local mock server — no real credentials needed:
docker run -d --name scanii-cli -p 4000:4000 ghcr.io/scanii/scanii-cli:latest server
composer install
composer testTest credentials: key key, secret secret, endpoint http://localhost:4000.
-"uvasoftware/scanii-php": "^5.0"
+"scanii/scanii-php": "^6.0"The PHP namespace is unchanged (Scanii\…). Other notable changes:
-
The runtime no longer depends on Guzzle. Only
ext-curlandext-json(both stdlib). -
The autoloader uses PSR-4 —
src/Scanii/...files moved up tosrc/.... -
Result objects use public
readonlyproperties instead of getters:- $r->getFindings() + $r->findings
-
process/processAsync/fetchnow take an explicit nullable?string $callbacklast arg (previously implicit through metadata):- $client->fetch($url, $callback, $metadata) + $client->fetch($url, $metadata, $callback)
-
Errors throw
Scanii\ScaniiException(andScaniiAuthException,ScaniiRateLimitExceptionsubclasses), not Guzzle exceptions.
The old composer coordinate uvasoftware/scanii-php is deprecated and will not receive further updates.
See https://scanii.github.io/openapi/v22/ for the full Scanii API contract.
Apache 2.0 — see LICENSE.