Search by

clearsoft / easysql-connectors-sqlite

joao-jlcm

EasySQL SQLite connector package — local schema introspection and SELECT execution for SQLite files.

Package info

github.com/Clearsoft-net/easysql-php-connectors-sqlite

Homepage

Issues

pkg:composer/clearsoft/easysql-connectors-sqlite

Statistics

Installs: 1

Dependents: 1

Suggesters: 1

Stars: 0

v3.3.0 2026-10-11 04:04 UTC

This package is auto-updated.

Last update: 2026-10-11 04:24:53 UTC


README

SQLite connector for the EasySQL PHP SDK — local schema introspection and SELECT execution.

Installation

composer require clearsoft/easysql-connectors-sqlite

Requirements: PHP >= 8.2, ext-pdo, ext-pdo_sqlite.

Usage

use Clearsoft\EasySQL\Connectors\SQLite\ConnectionConfig;
use Clearsoft\EasySQL\Connectors\SQLite\Connector;

$connector = new Connector(new ConnectionConfig(
    path: '/var/data/shop.db', // or ':memory:' (default)
    readOnly: true,            // default false
    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');
} finally {
    $connector->close();
}

Behavior

  • Introspection reads sqlite_master (excludes sqlite_% internals) + PRAGMA table_info / PRAGMA foreign_key_list per table; row counts via COUNT(*) (best effort, null on failure). It produces the shared raw shape (engine, engine-native dataType, and ordinal) consumed by clearsoft/easysql-schema-generation.
  • Execution accepts SELECT/WITH/EXPLAIN/SHOW only; prepared statements; typed rows.
  • Read-only mode opens the database with SQLITE_OPEN_READONLY — writes are rejected by the driver.
  • No global state — the database is opened per connection.

Tests

./vendor/bin/phpunit --testsuite connectors-sqlite

Tests use a temp-file fixture database (created in setUp, removed in tearDown) plus :memory: cases — no external service required.