Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Tissue Laravel Package

bubnov/tissue

Scan uploaded files for viruses in PHP via adapter-based integrations. Includes a ClamAV adapter to run ClamAV scans and report infected files, helping you add antivirus checks to your upload pipeline (keep signatures updated; follow upload security best practices).

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Adapter Pattern: The package’s adapter-based design (e.g., ClamAvAdapter) aligns well with Laravel’s dependency injection and interface-driven architecture. This enables easy swapping of scanning engines (e.g., for testing or future extensions).
  • Decoupled Logic: Scanning is abstracted from business logic, making it reusable across file uploads, downloads, or storage operations (e.g., S3, local filesystem). This fits Laravel’s service-layer philosophy.
  • Symfony Compatibility: While not Laravel-native, the package’s structure (e.g., service-oriented adapters) maps cleanly to Laravel’s service providers and facades, with minimal refactoring.
  • Limited Engine Support: Only ClamAV is supported, which may restrict use cases unless additional adapters (e.g., for Windows Defender, Sophos) are developed. This could force a custom solution or third-party integration (e.g., VirusTotal API) if multi-engine support is critical.

Integration Feasibility

  • Laravel Service Provider: The package can be bootstrapped via a Laravel service provider, registering the scanner as a singleton or context-bound instance (e.g., VirusScanner::scan()).
  • Facade Pattern: A custom facade (e.g., VirusScanner::scan($filePath)) simplifies API calls, reducing boilerplate in controllers or services.
  • Event-Driven Hooks: Integrate with Laravel’s events (e.g., file.uploaded) to trigger scans automatically, leveraging the event system for decoupled workflows.
  • Queueable Scans: For large files, offload scans to Laravel queues (e.g., ScanFileJob) to avoid blocking HTTP requests, improving responsiveness.

Technical Risk

  • Deprecated/Unmaintained:
    • Last release in 2017 introduces risks:
      • PHP 8.0+ compatibility: May require forking or wrapping ClamAV CLI calls directly.
      • Security vulnerabilities: Unpatched issues in ClamAV or the package itself.
      • Lack of community support: No active maintenance or updates.
  • Performance Overhead:
    • ClamAV scans add latency; caching results (e.g., Redis) or using async processing (queues) is critical for high-traffic systems.
  • False Positives/Negatives:
    • Misconfiguration or outdated ClamAV signatures may lead to unreliable scans, requiring manual review workflows.
  • Dependency Bloat:
    • Requires ClamAV installation on servers, adding operational complexity (e.g., freshclam updates, sandboxing).

Key Questions

  1. Compatibility:
    • Does the package support PHP 8.1+ and Laravel 10+? If not, what’s the effort to fork/modernize it?
    • Are there known issues with modern ClamAV versions (e.g., 1.0+)?
  2. Alternatives:
    • Are there actively maintained Laravel-specific packages (e.g., spatie/laravel-virus-scanner)?
    • Would a custom solution (direct ClamAV CLI calls) be simpler to maintain?
  3. Security:
    • How will scans be logged/audited? (e.g., Laravel’s logging or a custom scans table.)
    • What safeguards exist to prevent malicious file execution post-scan? (e.g., storing files outside web root.)
  4. Scaling:
    • How will scans handle distributed environments (e.g., Kubernetes)?
    • Can scans be parallelized or batched for large volumes?
  5. Maintenance:
    • Who will handle ClamAV updates and package maintenance?
    • Is there a fallback if the scanner fails (e.g., skip scan or use a lighter check)?

Integration Approach

Stack Fit

  • Laravel Ecosystem:
    • Service Container: Bind the scanner as a service (e.g., app()->bind(VirusScanner::class, fn() => new ClamAvAdapter())).
    • Facades: Create a VirusScanner facade for concise syntax (e.g., VirusScanner::scan($file)).
    • Events: Trigger scans via file.uploaded or file.stored events using Laravel’s event system.
    • Middleware: Add middleware to scan files before processing (e.g., in HandleIncomingRequest).
  • Storage Systems:
    • Local Filesystem: Scan files in storage/app/uploads using temporary copies.
    • Cloud Storage (S3, GCS): Stream files to ClamAV or use temporary local copies for scanning.
  • Queue System:
    • Use Laravel queues to defer scans for large files (e.g., ScanFileJob extending ShouldQueue).

Migration Path

  1. Evaluation Phase:
    • Test the package in staging with a subset of file types (e.g., PDFs, images).
    • Compare performance against direct ClamAV CLI calls (baseline).
  2. Pilot Integration:
    • Integrate with a single upload endpoint (e.g., API route).
    • Monitor scan success/failure rates and latency.
  3. Full Rollout:
    • Extend to all upload paths (e.g., admin dashboard, user uploads).
    • Implement fallback mechanisms (e.g., skip scan if ClamAV is down).
  4. Optimization:
    • Cache scan results for identical files (e.g., using file hashes in Redis).
    • Offload scans to a dedicated microservice if needed.

Compatibility

  • PHP/Laravel:
    • If compatibility issues arise, fork the package or wrap ClamAV CLI calls directly.
    • Use php-clamav (PHP extension) as an alternative if available.
  • ClamAV:
    • Ensure the server has ClamAV installed (sudo apt-get install clamav).
    • Configure freshclam for automatic signature updates.
  • File Formats:
    • Test with common types (PDFs, Office docs, archives) and edge cases (malformed files, large files).

Sequencing

  1. Prerequisites:
    • Install ClamAV and configure freshclam.
    • Set up Laravel service provider and facade.
  2. Core Integration:
    • Implement scan logic in upload handlers (e.g., StoreFileRequest).
    • Add error handling for scan failures (e.g., queue jobs for retries).
  3. Advanced Features:
    • Add queue-based scans for async processing.
    • Implement logging/auditing (e.g., scans table in DB).
  4. Monitoring:
    • Track scan success rates and false positives/negatives.
    • Set up alerts for ClamAV failures.

Operational Impact

Maintenance

  • ClamAV Updates:
    • Schedule daily freshclam updates via cron.
    • Monitor ClamAV version compatibility with the package.
  • Package Updates:
    • Fork the package if unmaintained or replace it with a modern alternative.
    • Test updates in staging before production deployment.
  • Dependency Management:
    • Pin ClamAV and PHP versions to avoid compatibility issues.

Support

  • Troubleshooting:
    • Log scan failures with context (e.g., file hash, user ID).
    • Provide user-friendly error messages (e.g., "File scan failed; please try again later").
  • False Positives/Negatives:
    • Implement a review workflow for flagged files (e.g., admin dashboard).
    • Document known false positives (e.g., legitimate files marked as malicious).
  • Security Audits:
    • Regularly audit file execution risks (e.g., ensure uploaded files are never served as PHP).
    • Restrict file types or use MIME type validation as an additional layer.

Scaling

  • Horizontal Scaling:
    • ClamAV scans are CPU-intensive; distribute scans across multiple servers if needed.
    • Use a dedicated scan service (e.g., microservice) for high-throughput systems.
  • Performance:
    • Cache scan results for identical files (e.g., using file hashes in Redis).
    • Limit scan queue depth to avoid overwhelming the system.
  • Fallback Mechanisms:
    • Gracefully degrade if ClamAV is unavailable (e.g., skip scan or use a lighter check like file extension validation).

Failure Modes

Failure Scenario Impact Mitigation
ClamAV service down Uploads blocked Fallback to lighter checks or queue scans.
Outdated signatures New malware slips through Automate freshclam updates; monitor signature dates.
False positives Legitimate files rejected Manual review workflow; whitelist known-safe files.
High scan latency Slow uploads Cache results; use async queues.
Package
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
datacore/hub-sdk
alengo/sulu-http-cache-bundle
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme
agtp/agtp-php
agtp/mod-php
centraldesktop/protobuf-php
trappistes/laravel-custom-fields
splash/sonata-admin
splash/metadata