clearsoft / easysql-connectors-mysql
EasySQL MySQL connector package — local schema introspection and SELECT execution for MySQL/MariaDB.
Package info
github.com/Clearsoft-net/easysql-php-connectors-mysql
pkg:composer/clearsoft/easysql-connectors-mysql
v3.3.0
2026-10-11 04:04 UTC
Requires
- php: >=8.2
- ext-pdo: *
- ext-pdo_mysql: *
- clearsoft/easysql-common: ^3.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
MySQL/MariaDB connector for the EasySQL PHP SDK — local schema introspection and SELECT execution.
Installation
composer require clearsoft/easysql-connectors-mysql
Requirements: PHP >= 8.2, ext-pdo, ext-pdo_mysql.
Usage
use Clearsoft\EasySQL\Connectors\MySQL\ConnectionConfig; use Clearsoft\EasySQL\Connectors\MySQL\Connector; $connector = new Connector(new ConnectionConfig( host: '127.0.0.1', // default port: 3306, // default user: 'readonly', password: 'secret', // in-memory only — never written to disk or logged database: 'myapp', charset: 'utf8mb4', // default engine: 'mysql', // or 'mariadb' ssl: false, // default timeout: 10.0, // seconds, default )); $connector->connect(); try { $raw = $connector->introspect(); // raw shape for the schema-generation package $result = $connector->execute('SELECT * FROM users LIMIT 10', ['status' => 'active']); // ['columns' => [...], 'rows' => [...], 'row_count' => N, 'duration_ms' => M] } finally { $connector->close(); }
Behavior
- Credentials are supplied per connection and never written to disk, logged, or kept after
close(). Driver error messages are sanitized before surfacing. - Introspection reads
information_schema(user tables only) and produces the shared raw shape (engine, engine-nativedataType, andordinal) consumed byclearsoft/easysql-schema-generation. - Execution accepts SELECT/WITH/EXPLAIN/SHOW only (client-side safety check mirrors the server); uses prepared statements and returns typed rows.
- No global state — several connections can be open at the same time.
Tests
./vendor/bin/phpunit --testsuite connectors-mysql
EASYSQL_TEST_MYSQL=1 ./vendor/bin/phpunit --testsuite connectors-mysql # + integration vs local MySQL
Integration env vars: EASYSQL_TEST_MYSQL_HOST/PORT/USER/PASSWORD/DATABASE (defaults 127.0.0.1:3306/root//easysql_test).