clearsoft / easysql-common
Shared code for the EasySQL PHP SDK packages (SQL safety validation, credential sanitization).
v3.3.0
2026-10-11 04:04 UTC
Requires
- php: >=8.2
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Shared code for the EasySQL PHP SDK packages.
Installation
composer require clearsoft/easysql-common
Requirements: PHP >= 8.2.
Contents
Clearsoft\EasySQL\Common\SqlValidator— client-side SELECT-only safety check used by the MySQL, PostgreSQL, SQLite and ClickHouse connectors before executing any generated SQL. Mirrors the server-side validator as defense in depth.Clearsoft\EasySQL\Common\CredentialSanitizer— strips credentials (connection URIs andpassword=/pwd=assignments) from driver messages before they are surfaced or logged.
Usage
use Clearsoft\EasySQL\Common\SqlValidator; use Clearsoft\EasySQL\Common\CredentialSanitizer; $result = SqlValidator::validateSelectOnly('SELECT * FROM users LIMIT 10'); if (!$result['ok']) { throw new RuntimeException($result['reason']); } echo CredentialSanitizer::sanitize('postgres://user:secret@host:5432/db'); // postgres://***@host:5432/db
Tests
./vendor/bin/phpunit --testsuite common