byjg / anydataset-db
Anydataset Database Relational abstraction. Anydataset is an agnostic data source abstraction layer in PHP.
Fund package maintenance!
byjg
Installs: 60 115
Dependents: 4
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 5
Open Issues: 0
Requires
- php: >=8.1 <8.4
- ext-json: *
- ext-pdo: *
- byjg/anydataset-array: ^5.0
- byjg/uri: ^5.0
- psr/cache: ^1.0|^2.0|^3.0
- psr/log: ^1.1|^2.0|^3.0
Requires (Dev)
- byjg/cache-engine: ^5.0
- phpunit/phpunit: ^9.6
- vimeo/psalm: ^5.9
Suggests
- ext-curl: *
- ext-oci8: *
- ext-pdo_mysql: *
- ext-pdo_pgsql: *
- byjg/cache-engine: ^5.0
Provides
README
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:
Example usage:
<?php $conn = \ByJG\AnyDataset\Db\Factory::getDbInstance("mysql://root:password@10.0.1.10/myschema");
Examples
- Getting Started
- Basic Query and Update
- Sql Statement Object
- Cache results
- Database Transaction
- Load Balance and Connection Pooling
- Database Helper
- Filtering the Query
Advanced Topics
- Passing Parameters to PDODriver
- Generic PDO Driver
- Running Tests
- Getting an Iterator from an existing PDO Statament
- Pre Fetch records
Database Specifics
Install
Just type:
composer require "byjg/anydataset"