crutch / database-pdo
database PDO implementation
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/crutch/database-pdo
Requires
- php: ^7.4 || ^8.0
- ext-pdo: *
- crutch/database: ^1.0
Provides
This package is not auto-updated.
Last update: 2025-10-10 03:45:14 UTC
README
Database PDO implementation
Install
composer require crutch/database-pdo
Usage
<?php /** @var \PDO $pdo */ $database = new \Crutch\DatabasePdo\DatabasePdo($pdo); $database->execute('INSERT INTO table (id, value) VALUES (?, ?)', [1, 'it is works']); $query = 'SELECT * FROM table WHERE id = ?'; $oneRow = $database->fetch($query, [1]); // $oneRow = ['id' => 1, 'value' => 'it is works']; $allRows = $database->fetchAll($query, [1]); // $allRows = [['id' => 1, 'value' => 'it is works']]; $database->begin(); try { $database->execute('DELETE FROM table WHERE id = :id', ['id' => 1]); $database->commit(); } catch (\Crutch\Database\Exception\StorageError $exception) { $database->rollback(); }