tina4stack / tina4php-pdo
Tina4 PHP PDO Database Driver
v2.0.2
2026-03-14 19:31 UTC
Requires
- php: >=8.1
- ext-json: *
- ext-pdo: *
- tina4stack/tina4php-database: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.2
- overtrue/phplint: ^2.0
- phpunit/phpunit: ^9
- roave/security-advisories: dev-latest
- tina4stack/tina4php-debug: ^2.0
README
PDO database driver for the Tina4 PHP framework.
Installation
composer require tina4stack/tina4php-pdo
Requirements
- PHP >= 8.1
- ext-pdo
- tina4stack/tina4php-database ^2.0
Usage
// Connection format: host/port:database (PDO DSN style) $DBA = new \Tina4\DataPDO("host/port:database", "username", "password"); // SQLite example (no credentials needed) $DBA = new \Tina4\DataPDO("sqlite:test.db"); // MSSQL via dblib example $DBA = new \Tina4\DataPDO("dblib:host=localhost:1433;dbname=mydb", "sa", "password"); // Execute queries $DBA->exec("create table users (id integer primary key, name varchar(200))"); $DBA->commit(); // Insert with parameters $DBA->exec("insert into users (id, name) values (?, ?)", 1, "Alice"); // Fetch records $result = $DBA->fetch("select * from users"); $records = $result->asArray(); // Fetch with limit and offset $result = $DBA->fetch("select * from users", 10, 0); // Fetch single record $record = $DBA->fetchOne("select * from users where id = 1"); // Check if table exists $exists = $DBA->tableExists("users"); // Get database metadata $metadata = $DBA->getDatabase();
Testing
docker compose up -d
composer test
License
MIT - see LICENSE
Our Sponsors
Sponsored with 🩵 by Code Infinity
Supporting open source communities • Innovate • Code • Empower