php-clamav icon indicating copy to clipboard operation
php-clamav copied to clipboard

Implement DSN Connection Strings Support

Open SoftCreatR opened this issue 1 year ago • 0 comments

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:

  1. Added a static createFromDSN method to the ClamAV abstract class. This method parses the provided DSN string and returns an appropriate instance (Network or Pipe).
  2. Updated the ClamAVTest unit test to cover the new DSN creation functionality.
  3. Updated composer dependencies
  4. Applied more minor code and documentation optimizations
  5. Improved code coverage
  6. 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.

SoftCreatR avatar Oct 10 '23 14:10 SoftCreatR