Awesome
Database v0.15.3
The Titon Database package provides a lightweight and low-level interface for interacting with database engines (known as drivers). The DB package comes bundled with a robust database abstraction layer (DBAL), an object oriented query builder, a powerful SQL dialect formatter, a data type caster, custom finder classes, behaviors, mappers, schemas, and many more.
$db = Titon\Db\Database::registry();
$db->addDriver('default', new Titon\Db\Mysql\MysqlDriver([
'user' => 'root',
'pass' => 'pass'
]));
$users = new Titon\Db\Repository(['table' => 'users']);
$entities = $users->select()->where('status', 1)->orderBy('created_at', 'desc')->all();
Supported database engines are packaged as individual driver packages, which are listed below.
Drivers
MySQL
- https://github.com/titon/db-mysqlPostgreSQL
- https://github.com/titon/db-postgresqlSQLite
- https://github.com/titon/db-sqliteMongoDB
- https://github.com/titon/db-mongodb
Features
Database
- Driver managerRepository
- Table representation, queries drivers, maps relations and returns entitiesBehavior
- Executes logic during database eventsEntity
- Single record of dataEntityCollection
- Collection of entitiesFinder
- Select query formattingDriver
- Interacts with a database or remote serviceDialect
- Driver specific SQL formattingSchema
- Repository schemaType
- Data type mappingResultSet
- Result set mapper
Query
- Object oriented query builderRawExpr
- Raw expression builderExpr
- Expression builderFunc
- Function builderJoin
- Join builderPredicate
- Clause builder
Dependencies
Common
Event
Type
Cache
(optional)Psr\Log
(optional)
Requirements
- PHP 5.4.0
- PDO