PHPackages                             retrochaos/virustotal-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. retrochaos/virustotal-api

ActiveLibrary[API Development](/categories/api)

retrochaos/virustotal-api
=========================

A PHP library for using VirusTotal's API

v0.05(1y ago)12MITPHPPHP ^7.4 || ^8.1

Since Jan 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/RetroChaos/VirusTotalApi)[ Packagist](https://packagist.org/packages/retrochaos/virustotal-api)[ RSS](/packages/retrochaos-virustotal-api/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (3)Versions (7)Used By (0)

VirusTotal API
==============

[](#virustotal-api)

A PHP library for accessing the [VirusTotal API](https://docs.virustotal.com/reference/overview).

Based off of work done by [IzzySoft](https://github.com/IzzySoft/virustotal/) and [jayzeng](https://github.com/jayzeng/virustotal_apiwrapper/).

Uses Guzzle6 or Guzzle7

Install
-------

[](#install)

Install using [composer](https://getcomposer.org/)

```
composer install retrochaos/virustotal-api
```

Usage
-----

[](#usage)

1. Firstly you need to instantiate a HttpClient object with your API key from VirusTotal (you can obtain one from creating an account for free).
2. Then you create a new Service object with the HttpClient. This is the main object where requests are made, such as scanning files, domains and IPs. Behind the scenes API objects are actually making the calls.
3. The Service object will return back a Response object of that type eg. if you're calling: `$service->scanDomain()` a `DomainResponse` object will be returned. You can always call the `getRawResponse()` method on the object to get an associative array returned from Guzzle
4. To aid with your code, each response comes with a dedicated Analyser class to call specific methods on the response that was returned, e.g. a DomainAnalyser object requires a DomainResponse object.

To recap: HttpClient -&gt; Service -&gt; Response -&gt; Analyser

Example script modified from `test/file-test.php`

```
use RetroChaos\VirusTotalApi\Analyser\FileAnalyser;
use RetroChaos\VirusTotalApi\Exception\PropertyNotFoundException;
use RetroChaos\VirusTotalApi\HttpClient;
use RetroChaos\VirusTotalApi\Service;

$httpClient = new HttpClient('your-api-key');
$virusTotal = new Service($httpClient);

//Password optional
echo "Scanning until complete...\n";
$response = $virusTotal->scanFileUntilCompleted('/path/to/file.zip');

if ($response->isSuccessful()) {
	$analyser = new FileAnalyser($response);
	try {
		echo $analyser->getStatus() . "\n";
		echo $analyser->isFileSafe() ? "File is safe!\n" : "File is malicious!\n";
		echo $analyser->getFileSize() . "MB\n";
	} catch (PropertyNotFoundException $e) {
		echo $e->getMessage() . "\n";
	}
} else {
	echo $response->getErrorMessage() . "\n";
}
```

Another example is testing IP addresses: (Example script modified from `test/ip-test.php`)

```
use RetroChaos\VirusTotalApi\Analyser\IpAddressAnalyser;
use RetroChaos\VirusTotalApi\HttpClient;
use RetroChaos\VirusTotalApi\Exception\PropertyNotFoundException;
use RetroChaos\VirusTotalApi\Service;

$httpClient = new HttpClient('your-api-key');
$virusTotal = new Service($httpClient);

$response = $virusTotal->scanIpAddress('8.8.8.8');

if ($response->isSuccessful()) {
	try {
		$analyser = new IpAddressAnalyser($response);
		echo $analyser->isIpAddressSafe() ? "IP address is safe!\n" : "IP address is malicious!\n";
		echo $analyser->getLastAnalysisDate() . "\n";
	} catch (PropertyNotFoundException $e) {
		echo $e->getMessage() ."\n";
	}
} else {
	echo $response->getErrorMessage() . "\n";
}
```

TODO
----

[](#todo)

- Add other methods found in the API.
- POST file data to the endpoint, not just filesystem paths.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

518d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1346654?v=4)[Sam Hawes](/maintainers/RetroChaos)[@RetroChaos](https://github.com/RetroChaos)

---

Top Contributors

[![RetroChaos](https://avatars.githubusercontent.com/u/1346654?v=4)](https://github.com/RetroChaos "RetroChaos (9 commits)")

### Embed Badge

![Health badge](/badges/retrochaos-virustotal-api/health.svg)

```
[![Health](https://phpackages.com/badges/retrochaos-virustotal-api/health.svg)](https://phpackages.com/packages/retrochaos-virustotal-api)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M992](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
