Skip to content

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

License

Notifications You must be signed in to change notification settings

byjg/php-anydataset-db

Repository files navigation

AnyDataset-DB

Build Status Opensource ByJG GitHub source GitHub license GitHub release

AnyDataset-DB provides a relational database abstraction layer. It is part of the Anydataset project, an agnostic data source abstraction layer for PHP.

Learn more about Anydataset here.

Features

  • Connection based on URI
  • Handles compatibility and code optimization across multiple databases (e.g., MySQL, PostgreSQL, MS SQL Server)
  • Built-in Query Cache support using a PSR-6 compliant interface
  • Enables connection routing based on regular expressions for queries (e.g., directing queries to different databases for specific tables)

Connection Based on URI

Database connections are defined using URL-based connection strings.

Supported drivers are listed below:

Database Connection String Factory Method
SQLite sqlite:///path/to/file getDbRelationalInstance()
MySQL/MariaDB mysql://username:password@hostname:port/database getDbRelationalInstance()
PostgreSQL psql://username:password@hostname:port/database getDbRelationalInstance()
SQL Server (DbLib) dblib://username:password@hostname:port/database getDbRelationalInstance()
SQL Server (Sqlsrv) sqlsrv://username:password@hostname:port/database getDbRelationalInstance()
Oracle (OCI8) oci8://username:password@hostname:port/database getDbRelationalInstance()
Generic PDO pdo://username:password@pdo_driver?PDO_PARAMETERS getDbRelationalInstance()

Example usage:

<?php
$conn = \ByJG\AnyDataset\Db\Factory::getDbInstance("mysql://root:[email protected]/myschema");

Examples

Advanced Topics

Database Specifics

Install

Just type:

composer require "byjg/anydataset"

Dependencies

flowchart TD
    byjg/anydataset-db --> byjg/anydataset-array
    byjg/anydataset-db --> ext-pdo
    byjg/anydataset-db --> byjg/uri
    byjg/anydataset-db --> psr/cache
    byjg/anydataset-db --> psr/log
Loading

Open source ByJG

About

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

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published