How adriengras/php-clamav works
Main Components
a. Client Layer:
• Two initialization methods: fromDSN() and fromParts()
b. Connector Layer:
• ConnectorInterface at the top
• AbstractConnector implementation
• Branch into two concrete implementations: SocketConnector and TcpConnector
c. External Components:
• ClamAV Daemon (clamd)
• Unix Socket / TCP Socket connections
• Client Application (using the library)
Relationships and Interactions
• Communication flow from Connectors to the clamd daemon
• Supported commands (PING, SCAN, VERSION, etc.) as interfaces between components
Specific Implementation Details
• Rectangle: Main classes (ClamAV, Connectors)
• Hexagon: External services (clamd)
• Oval: Communication protocols (TCP/Unix Sockets)
[Client Application]
• ↓
• [ClamAV]
• ↓
[ConnectorInterface]
• ↓
[AbstractConnector]
• ↙ ↘
[Socket] [TCP]
• ↘ ↙
• [clamd daemon]
Important Elements to Highlight
• Command Flow: Show how commands like scan(), ping(), version() flow through the system
• Error Handling: Indicate where exceptions might occur
• Configuration Options: Show how different connection methods are handled
• Protocol Support: Highlight both Unix and TCP socket support
Technical Details
• PHP 8.0+ requirement
• Sockets extension dependency
• Supported clamd commands
• Connection string formats (DSN)