php-clamav
php-clamav copied to clipboard
Implement DSN Connection Strings Support
This PR introduces support for DSN connection strings to simplify the configuration process. Users can now use a single string to determine the type of connection (Network
or Pipe
) and its details.
This PR resolves #28, closes #25, resolves #26, closes #27, closes #31
Changes:
- Added a static
createFromDSN
method to theClamAV
abstract class. This method parses the provided DSN string and returns an appropriate instance (Network
orPipe
). - Updated the
ClamAVTest
unit test to cover the new DSN creation functionality. - Updated composer dependencies
- Applied more minor code and documentation optimizations
- Improved code coverage
- Updated README
Usage:
Users can now initialize a connection using a DSN string:
$clam = ClamAV::createFromDSN('tcp://localhost:3310');
$version = $clam->version();
This approach provides a more flexible and user-friendly way to set up a connection.
Testing:
Existing unit tests have been updated accordingly.