{"id":15003220,"url":"https://github.com/byjg/php-anydataset-db","last_synced_at":"2026-03-14T22:14:59.359Z","repository":{"id":52795474,"uuid":"158027834","full_name":"byjg/php-anydataset-db","owner":"byjg","description":"Anydataset Database Relational abstraction. Anydataset is an agnostic data source abstraction layer in PHP.","archived":false,"fork":false,"pushed_at":"2025-01-07T01:35:05.000Z","size":363,"stargazers_count":5,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T07:51:14.251Z","etag":null,"topics":["anydataset","byjg","database","microsoft-sql-server","mysql","postgressql","relational-databases","sqlite3"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byjg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"byjg"}},"created_at":"2018-11-17T21:49:56.000Z","updated_at":"2025-01-07T01:34:49.000Z","dependencies_parsed_at":"2024-01-04T22:25:52.997Z","dependency_job_id":"d23481c1-22c3-40e8-8989-00049609f2ff","html_url":"https://github.com/byjg/php-anydataset-db","commit_stats":{"total_commits":44,"total_committers":1,"mean_commits":44.0,"dds":0.0,"last_synced_commit":"31ee3d50330129a1158db17ae8dbc2f00ef39451"},"previous_names":["byjg/php-anydataset-db","byjg/anydataset-db"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byjg%2Fphp-anydataset-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byjg%2Fphp-anydataset-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byjg%2Fphp-anydataset-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byjg%2Fphp-anydataset-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byjg","download_url":"https://codeload.github.com/byjg/php-anydataset-db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238950485,"owners_count":19557533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anydataset","byjg","database","microsoft-sql-server","mysql","postgressql","relational-databases","sqlite3"],"created_at":"2024-09-24T18:57:11.827Z","updated_at":"2026-03-14T22:14:59.353Z","avatar_url":"https://github.com/byjg.png","language":"PHP","funding_links":["https://github.com/sponsors/byjg"],"categories":[],"sub_categories":[],"readme":"---\nsidebar_key: anydataset-db\ntags: [php, anydataset, databases]\n---\n\n# Database Abstraction Layer\n\n**AnyDataset-DB** provides a relational database abstraction layer. It is part of the Anydataset project, an agnostic\ndata source abstraction layer for PHP.\n\n[![Sponsor](https://img.shields.io/badge/Sponsor-%23ea4aaa?logo=githubsponsors\u0026logoColor=white\u0026labelColor=0d1117)](https://github.com/sponsors/byjg)\n[![Build Status](https://github.com/byjg/php-anydataset-db/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/php-anydataset-db/actions/workflows/phpunit.yml)\n[![Opensource ByJG](https://img.shields.io/badge/opensource-byjg-success.svg)](http://opensource.byjg.com)\n[![GitHub source](https://img.shields.io/badge/Github-source-informational?logo=github)](https://github.com/byjg/php-anydataset-db/)\n[![GitHub license](https://img.shields.io/github/license/byjg/php-anydataset-db.svg)](https://opensource.byjg.com/opensource/licensing.html)\n[![GitHub release](https://img.shields.io/github/release/byjg/php-anydataset-db.svg)](https://github.com/byjg/php-anydataset-db/releases/)\n\nLearn more about Anydataset [here](https://opensource.byjg.com/anydataset).\n\n## Features\n\n- Connection based on URI\n- Handles compatibility and code optimization across multiple databases (e.g., MySQL, PostgreSQL, MS SQL Server)\n- Built-in Query Cache support using a PSR-16 compliant interface\n- Enables connection routing based on regular expressions for queries (e.g., directing queries to different databases\n  for specific tables)\n\n## Connection Based on URI\n\nDatabase connections are defined using URL-based connection strings.\n\nSupported drivers are listed below:\n\n| Database            | Connection String                                 | Factory Method    |\n|---------------------|---------------------------------------------------|-------------------|\n| SQLite              | sqlite:///path/to/file                            | `getDbInstance()` |\n| MySQL/MariaDB       | mysql://username:password@hostname:port/database  | `getDbInstance()` |\n| PostgreSQL          | psql://username:password@hostname:port/database   | `getDbInstance()` |\n| SQL Server (DbLib)  | dblib://username:password@hostname:port/database  | `getDbInstance()` |\n| SQL Server (Sqlsrv) | sqlsrv://username:password@hostname:port/database | `getDbInstance()` |\n| Oracle (OCI8)       | oci8://username:password@hostname:port/database   | `getDbInstance()` |\n| Generic PDO         | pdo://username:password@pdo_driver?PDO_PARAMETERS | `getDbInstance()` |\n\nExample usage:\n\n```php\n\u003c?php\n$conn = \\ByJG\\AnyDataset\\Db\\Factory::getDbInstance(\"mysql://root:password@10.0.1.10/myschema\");\n```\n\n## Examples\n\n- [Getting Started](docs/getting-started.md)\n- [Basic Query and Update](docs/basic-query.md)\n- [Sql Statement Object](docs/sqlstatement.md)\n- [Cache results](docs/cache.md)\n- [Database Transaction](docs/transaction.md)\n- [Load Balance and Connection Pooling](docs/load-balance.md)\n- [Database Helper](docs/helper.md)\n- [Filtering the Query](docs/iteratorfilter.md)\n- [Entity Mapping](docs/entity.md)\n\n## Advanced Topics\n\n- [Database Driver Interface](docs/db-driver-interface.md)\n- [DatabaseExecutor - Recommended API](docs/database-executor.md)\n- [Passing Parameters to PDODriver](docs/parameters.md)\n- [Generic PDO Driver](docs/generic-pdo-driver.md)\n- [Running Tests](docs/tests.md)\n- [Getting an Iterator from an existing PDO Statement](docs/pdostatement.md)\n- [Pre Fetch records](docs/prefetch.md)\n- [Logging](docs/logging.md)\n- [Deprecated Features](docs/deprecated-features.md)\n\n## Database Specifics\n\n- [MySQL](docs/mysql.md)\n- [PostgreSQL](docs/postgresql.md)\n- [Oracle](docs/oracle.md)\n- [SQLServer](docs/sqlserver.md)\n- [Literal PDO Connection String](docs/literal-pdo-driver.md)\n\n\n## Install\n\nJust type:\n\n```bash\ncomposer require \"byjg/anydataset-db\"\n```\n\n## Dependencies\n\n```mermaid\nflowchart TD\n    byjg/anydataset-db --\u003e byjg/anydataset\n    byjg/anydataset-db --\u003e ext-pdo\n    byjg/anydataset-db --\u003e byjg/uri\n    byjg/anydataset-db --\u003e psr/cache\n    byjg/anydataset-db --\u003e psr/log\n```\n\n----\n[Open source ByJG](http://opensource.byjg.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyjg%2Fphp-anydataset-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyjg%2Fphp-anydataset-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyjg%2Fphp-anydataset-db/lists"}