Skip to main content

AnyDataset-DB

Build Status Opensource ByJG GitHub source GitHub license GitHub release

Anydataset Database Relational abstraction. Anydataset is an agnostic data source abstraction layer in PHP.

See more about Anydataset here.

Features

  • Connection based on URI
  • Support and fix code tricks with several databases (MySQL, PostgresSql, MS SQL Server, etc)
  • Natively supports Query Cache by implementing a PSR-6 interface
  • Supports Connection Routes based on regular expression against the queries, that's mean a select in a table should be executed in a database and in another table should be executed in another (even if in different DB)

Connection Based on URI

The connection string for databases is based on URL.

See below the current implemented drivers:

DatabaseConnection StringFactory
Sqlitesqlite:///path/to/filegetDbRelationalInstance()
MySql/MariaDbmysql://username:password@hostname:port/databasegetDbRelationalInstance()
Postgrespsql://username:password@hostname:port/databasegetDbRelationalInstance()
Sql Server (DbLib)dblib://username:password@hostname:port/databasegetDbRelationalInstance()
Sql Server (Sqlsrv)sqlsrv://username:password@hostname:port/databasegetDbRelationalInstance()
Oracle (OCI)oci://username:password@hostname:port/databasegetDbRelationalInstance()
Oracle (OCI8)oci8://username:password@hostname:port/databasegetDbRelationalInstance()
Generic PDOpdo://username:password@pdo_driver?PDO_PARAMETERSgetDbRelationalInstance()
<?php
$conn = \ByJG\AnyDataset\Db\Factory::getDbRelationalInstance("mysql://root:[email protected]/myschema");

Examples

Advanced Topics

Install

Just type:

composer require "byjg/anydataset"

Dependencies


Open source ByJG