Download the PHP
package kraenzle-ritter/clamav-scan without Composer
On this page you can find all versions of the php package
kraenzle-ritter/clamav-scan. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor kraenzle-ritter Package clamav-scan Short Description Scan files for malware with ClamAV: a small clamd client (INSTREAM over a Unix or TCP socket) and a fake scanner for tests. License
MIT Homepage https://github.com/kraenzle-ritter/clamav-scan
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.
In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
[](https://github.com/kraenzle-ritter/clamav-scan/actions/workflows/ci.yml)
[](https://packagist.org/packages/kraenzle-ritter/clamav-scan)
[](https://packagist.org/packages/kraenzle-ritter/clamav-scan)
[](https://www.php.net/)
[](https://phpstan.org/)
[](LICENSE)
Scans files for malware with ClamAV. Used by agate (SIP preparation) and
Anton (archival description), so that both check uploads the same way and
against the same clamd.
The package is a small client for clamd. It sends each file over a Unix or
TCP socket with `zINSTREAM`, so clamd never has to read the file itself: no
shared paths between containers, no file permissions for the clamav user.
It has no dependencies beyond PHP 8.2 and does not depend on Laravel; each
application binds it in its own way.
## Installation
## Use
A scan ends in one of three results:
| Status | Meaning |
|---|---|
| `clean` | clamd found nothing |
| `infected` | clamd found a signature; `signature` names it |
| `error` | clamd answered but did not check the file, e.g. `INSTREAM size limit exceeded.` Not clean. |
When clamd cannot be reached, does not answer within the timeout or closes
the connection without an answer, `scan()` throws a `ConnectionException`.
That is not a verdict on the file. A missing or unreadable file throws a
`FileNotReadableException`.
`version()` returns engine and signature version
(`ClamAV 1.4.3/27430/Thu Oct 16 08:30:00 2026`); record it with the result.
It is null when clamd does not answer, or does not tell: Debian and Ubuntu
ship ClamAV 1.5 with `EnableVersionCommand no` — set it to `yes` if you
need the signature version.
`scanStream($stream, $name)` scans an open stream, e.g. an upload that is
not on disk yet; `scanStream($stream, $name, $length)` only its next
`$length` bytes.
### Files over 2 GB
ClamAV cannot scan a file over 2 GB. `ClamdScanner` and `FakeScanner` are
`RangeScanner`s: `scanRange($path, $offset, $length)` scans part of a file,
so a large one can be scanned in overlapping parts. That is weaker than a
scan of the whole file: clamd sees the bytes of each part, not the format.
Signatures by byte pattern are found; those anchored at the end of the file
or tied to its structure, and hashes of the whole file, are not. Record such
a file as scanned in parts, not as clean.
### Options
## Tests in your application
`FakeScanner` needs no clamd. It reports files as infected or as errors by
pattern (fnmatch on the full path or the file name), and finds the EICAR
test string in a file's content:
Prefer patterns over EICAR files on disk. **macOS XProtect blocks and
deletes an EICAR file as soon as it is written**, also in a ddev project
whose files live on the Mac. `Eicar::string()` gives the bytes for a stream.
## clamd
clamd keeps its signatures in memory: plan for **1–1.5 GB of RAM**, briefly
twice that while it reloads them unless `ConcurrentDatabaseReload no` is
set. `freshclam` keeps the signatures up to date.
- Debian/Ubuntu: `apt install clamav-daemon clamav-freshclam`; the socket is
`/var/run/clamav/clamd.ctl`. The web server user needs access to it
(group `clamav`), or use `TCPSocket 3310` with `TCPAddr 127.0.0.1`.
- `StreamMaxLength` (default 100 MB) caps what clamd accepts over
`INSTREAM`. Larger files come back as `error`. Set it to the largest file
you expect, e.g. `StreamMaxLength 4000M`.
- **`MaxFileSize` and `MaxScanSize` (defaults 100 MB and 400 MB): beyond
them clamd stops scanning and answers `OK`.** Raise them together with
`StreamMaxLength`, and set `AlertExceedsMax yes`, so that a file clamd
did not scan fully comes back as infected with
`Heuristics.Limits.Exceeded.*` instead of clean.
- Docker: `clamav/clamav-debian` (amd64 and arm64; `clamav/clamav` is
amd64 only). It runs freshclam itself and listens on port 3310.
## Development
The integration tests run against a real clamd when `CLAMD_SOCKET` is set:
## License
MIT
Composer command for our command line client (download client)This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.Standard composer command
The package kraenzle-ritter/clamav-scan contains the following files
Loading the files please wait ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.