Skip to content

syframework/db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sy/db

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
        )
)

About

A simple database layer based on PDO

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages