- How do I install this package in a Laravel project?
- Run `composer require cleentfaar/tissue-clamav-adapter tissue/ti` to install the adapter and its Tissue dependency. Ensure ClamAV daemon (`clamd`) is running on your server, then configure Tissue to use the adapter in your filesystem setup.
- Does this work with Laravel’s built-in file upload handling?
- Yes, you can integrate it with Laravel’s file uploads by scanning files post-upload in an event listener (e.g., `FileUploaded`). Use the adapter’s `scan()` method on the uploaded file to check for malware before processing further.
- What Laravel versions are supported?
- This package works with Laravel 8+ (PHP 8.0+) since it depends on Tissue 3.x. Older Laravel versions may require Tissue polyfills or forks, but compatibility isn’t officially guaranteed.
- How do I handle false positives or scan failures?
- Wrap the scan in a `try-catch` block to catch `ClamavException` or socket timeouts. Implement fallback logic (e.g., skip scanning if ClamAV is down) or log results for manual review to reduce false positives.
- Can I use this for large files (e.g., videos >1GB)?
- ClamAV has memory limits for large files, so scans may fail. For high-volume or large files, consider chunked scanning or offloading scans to a queue worker (e.g., Laravel Queues) to avoid timeouts or crashes.
- Is there a way to scan files asynchronously?
- Yes, dispatch the scan to a Laravel queue job. Store the file temporarily, scan it in a background worker, then notify the user via email or database updates once the result is ready.
- What are the alternatives if I’m not using Tissue?
- If Tissue isn’t part of your stack, consider native PHP-ClamAV bindings like `php-clamav` or serverless options like AWS S3 + Amazon VirusTotal. These avoid Tissue’s dependency but may lack its file abstraction features.
- How do I configure ClamAV for Docker environments?
- Run ClamAV in a separate Docker container with the `clamav/clamav` image. Expose the `clamd` socket to your Laravel container (e.g., via Docker network) and point the adapter to the socket path (e.g., `/var/run/clamav/clamd.ctl`).
- Does this package support Windows servers?
- ClamAV on Windows is less stable, and the adapter assumes a Unix-like socket interface. If you must use Windows, test thoroughly or consider a Linux-based ClamAV daemon in a VM/Docker container.
- How can I test this in CI/CD pipelines?
- Mock the ClamAV daemon in tests using a lightweight stub or a local ClamAV instance in your CI environment. Ensure your pipeline validates the adapter’s `scan()` method returns expected results for both clean and infected files.