Download the PHP package eznio/db without Composer
On this page you can find all versions of the php package eznio/db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package db
Short Description DB Collections library inspired by Laravel
License MIT
Homepage https://github.com/eznio/sqlite-collections
Informations about the package db
ezn.io\db
DB Entity Collections library inspired by Laravel
Quickstart
More details
Supported RDBMS
SQLite and MySQL for now.
Error handling
Especially designed to be silent, no internal exceptions. Functions return null
/[]
if anything happens.
Placeholders basics
Several driver's functions accept second parameter called $args
. This is list of placeholder values. Library is using PDO placeholders syntax, so we have 2 options:
-
use
?
as placeholder name and provide simple list of substitutions:In this case, substitutions order should be the same as in query.
-
use
:named:
placeholders:Named substitutions can be passed in any order.
Reference
Driver
Driver is DB-specific request handling class. Implements the \eznio\db\drivers\Driver
interface.
query()
Runs SQL query and doesn't return anything. Useful for system queries like "SET NAMES" or similar.
select()
Runs SQL query and returns produced result as array.
If ARRAY_KEY
alias exists in resulting set - it's value will be added as array keys (and removed from resulting rows):
getRow()
Runs SQL query and returns produced its first row as array.
getColumn()
Runs SQL query and returns produced its first column as array of one-element arrays.
ARRAY_KEY
alias also works here:
getCell()
Runs SQL query and returns produced its first column of its first row:
load()
Shortcut to get values of a single row from given table by id:
insert()
Inserts data into the table and returns inserted ID
update()
Updates existing data by row ID:
delete()
Deletes row with given ID: