PHP SDK

Detectant PHP SDK
Detectant is a malware scanning API with support for PHP
Scan files for malware from PHP.
Install
This SDK requires PHP 8.3 or later and a PSR-18 HTTP client implementation.
Set your API key in the environment:
Create a client
By default, requests are sent to https://api.detectant.com.
Scan one file
The simplest PHP option is a file path:
The call completes after the file has been analyzed and returns its scan result.
Supported file inputs
Choose the input that already fits your application:
The SDK accepts file paths, in-memory strings, and PSR-7 streams. For in-memory data and streams, provide a filename and content type when they are known.
Scan a batch
Upload between 1 and 20 files. Results are returned in the same order as the inputs.
One file can fail without preventing the other files in the batch from being scanned. Check each item’s scan and error values.
Configuration
Increase the timeout for large files when needed:
Requests retry transient failures twice by default. Override retries globally or for one request:
Custom HTTP client
The SDK discovers an installed PSR-18 client automatically. You can also provide one explicitly:

