sy / db
Simple database layer on top of PDO
Installs: 1 318
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.0
- psr/log: ^1.1
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-10-07 17:15:51 UTC
README
Database layer based on PDO
Installation
Install the latest version with
composer require sy/db
Basic Usage
<?php use Sy\Db\Gate; // connection $this->gate = new Gate('sqlite:' . __DIR__ . '/database.db'); // create table $this->gate->execute(' CREATE TABLE test_table ( id INTEGER PRIMARY KEY, name TEXT NOT NULL ) '); // insert $this->gate->insert('test_table', ['id' => 1, 'name' => 'hello']); // select $res = $this->gate->queryAll('SELECT * FROM test_table', PDO::FETCH_ASSOC); print_r($res);
Output
Array
(
[0] => Array
(
[id] => 1
[name] => hello
)
)