- How do I install xenolope/quahog in a Laravel project?
- Run `composer require xenolope/quahog` in your project directory. The package uses PSR-4 autoloading, so no additional configuration is needed unless you’re using SSH (requires phpseclib). Ensure your ClamAV daemon (clamd) is running before use.
- What Laravel versions does xenolope/quahog support?
- The package is compatible with Laravel 5.6+ and PHP 5.6+. For Laravel 9/10, use it with PSR-15 middleware or a custom service provider. No breaking changes are expected for PHP 8.x, but test thoroughly with your stack.
- Can I use xenolope/quahog for real-time file upload scanning in Laravel?
- Yes, integrate it as middleware to scan files during uploads. Example: Create a `ScanUpload` middleware that checks `$request->file()` against ClamAV before processing. For large files, consider offloading scans to a background job to avoid timeouts.
- How do I handle ClamAV connection issues in production?
- Fallback to a local Unix socket (`unix:///var/run/clamav/clamd.ctl`) if SSH is unreliable. For production, ensure clamd is monitored and use Laravel’s queue dead-lettering if scans fail. Dockerize ClamAV or use a managed service (e.g., AWS ClamAV) for reliability.
- Does xenolope/quahog support scanning files larger than 100MB?
- ClamAV may struggle with very large files (>100MB) due to memory limits. Test performance with your file sizes and consider chunked scanning or splitting files. Monitor scan times and adjust timeouts in your Laravel configuration.
- How can I log or audit scan results for compliance (e.g., GDPR)?
- Extend Quahog’s basic exceptions with custom logging. Use Laravel’s `Log` facade to record scan results, including file metadata and infection status. For GDPR, ensure logs are encrypted and purged according to retention policies.
- What are the alternatives to xenolope/quahog for Laravel virus scanning?
- For more flexibility, use direct `exec()` calls to clamd (less portable but customizable). For machine learning-based scanning, explore `rubix/ml`. If Quahog lacks features, consider forking it or switching to a maintained package like `php-clamav` (if available).
- How do I integrate xenolope/quahog with Laravel queues for async scanning?
- Create a job (e.g., `ScanFileJob`) that extends Laravel’s `Job` class. Pass the file path to the job, then use `$client->scanFile()` in the `handle()` method. Dispatch the job from your upload controller or middleware to avoid blocking requests.
- What’s the best way to update ClamAV virus definitions in Laravel?
- Use an Artisan command to trigger ClamAV updates. Example: `php artisan clamav:update` with a shell command like `freshclam`. Schedule this command via Laravel’s scheduler (e.g., `* * * * * php artisan clamav:update`) for automated refreshes.
- Is xenolope/quahog actively maintained? What if I need fixes?
- The package hasn’t seen updates in 3 years, so test thoroughly in your environment. If critical issues arise, fork the repository or consider alternatives. For production use, prioritize this package only if ClamAV’s stability aligns with your risk tolerance.