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. retrochaos/virustotal-api

ActiveLibrary

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 1mo ago

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

25

—

LowBetter than 37% of packages

Maintenance42

Moderate activity, may be stable

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

463d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/205cfb375a050d5402c605535bfa86babb26fff77dd01ba8deb49a4aaa1bc888?d=identicon)[RetroChaos](/maintainers/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.6k509.9M17.0k](/packages/laravel-framework)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[ashallendesign/laravel-exchange-rates

A wrapper package for interacting with the exchangeratesapi.io API.

485677.8k](/packages/ashallendesign-laravel-exchange-rates)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[concrete5/core

Concrete core subtree split

19159.3k48](/packages/concrete5-core)

PHPackages © 2026

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