https://github.com/byjg/php-anydataset-db
Anydataset Database Relational abstraction. Anydataset is an agnostic data source abstraction layer in PHP.
https://github.com/byjg/php-anydataset-db
anydataset byjg database microsoft-sql-server mysql postgressql relational-databases sqlite3
Last synced: 5 months ago
JSON representation
Anydataset Database Relational abstraction. Anydataset is an agnostic data source abstraction layer in PHP.
- Host: GitHub
- URL: https://github.com/byjg/php-anydataset-db
- Owner: byjg
- License: mit
- Created: 2018-11-17T21:49:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-07T01:35:05.000Z (6 months ago)
- Last Synced: 2025-02-02T07:51:14.251Z (5 months ago)
- Topics: anydataset, byjg, database, microsoft-sql-server, mysql, postgressql, relational-databases, sqlite3
- Language: PHP
- Size: 354 KB
- Stars: 5
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# AnyDataset-DB
[](https://github.com/byjg/php-anydataset-db/actions/workflows/phpunit.yml)
[](http://opensource.byjg.com)
[](https://github.com/byjg/php-anydataset-db/)
[](https://opensource.byjg.com/opensource/licensing.html)
[](https://github.com/byjg/php-anydataset-db/releases/)**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](https://opensource.byjg.com/anydataset).
## 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
byjg/anydataset-array
byjg/anydataset-db --> ext-pdo
byjg/anydataset-db --> byjg/uri
byjg/anydataset-db --> psr/cache
byjg/anydataset-db --> psr/log
```----
[Open source ByJG](http://opensource.byjg.com)