{"id":33952822,"url":"https://github.com/eufony/dbal","last_synced_at":"2026-06-01T04:31:29.294Z","repository":{"id":47699221,"uuid":"516259287","full_name":"eufony/dbal","owner":"eufony","description":"Zero-configuration extensible PHP database abstraction layer library.","archived":false,"fork":false,"pushed_at":"2023-02-13T07:29:23.000Z","size":247,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"v1.x","last_synced_at":"2025-12-14T08:40:12.913Z","etag":null,"topics":["dbal","eufony","php","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eufony.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/Supporting_other_Databases.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-21T06:54:34.000Z","updated_at":"2023-02-05T17:45:07.000Z","dependencies_parsed_at":"2022-09-23T16:50:12.704Z","dependency_job_id":null,"html_url":"https://github.com/eufony/dbal","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/eufony/dbal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eufony%2Fdbal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eufony%2Fdbal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eufony%2Fdbal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eufony%2Fdbal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eufony","download_url":"https://codeload.github.com/eufony/dbal/tar.gz/refs/heads/v1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eufony%2Fdbal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33760645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dbal","eufony","php","sql"],"created_at":"2025-12-12T19:49:11.047Z","updated_at":"2026-06-01T04:31:29.277Z","avatar_url":"https://github.com/eufony.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eThe Eufony DBAL Package\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/eufony/dbal\"\u003e\n        \u003cimg alt=\"Packagist Downloads\" src=\"https://img.shields.io/packagist/dt/eufony/dbal?label=Packagist%20Downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/eufony/dbal\"\u003e\n        \u003cimg alt=\"GitHub Stars\" src=\"https://img.shields.io/github/stars/eufony/dbal?label=GitHub%20Stars\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/eufony/dbal/issues\"\u003e\n        \u003cimg alt=\"Issues\" src=\"https://img.shields.io/github/issues/eufony/dbal/open?label=Issues\"\u003e\n    \u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://github.com/eufony/dbal#license\"\u003e\n        \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/eufony/dbal?label=License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/eufony/dbal#contributing\"\u003e\n        \u003cimg alt=\"Community Built\" src=\"https://img.shields.io/badge/Made%20with-%E2%9D%A4-red\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n*eufony/dbal provides an abstraction layer over SQL to ease development using relational database management systems and\nto prevent lock-in to a specific SQL flavor.*\n\n*eufony/dbal* is a PHP library that handles interfacing with the relational database of your choice. It uses an\nexpressive syntax that is then translated on-the-fly to the appropriate syntax for your SQL flavor. Using it, you'll\nenjoy all the benefits of plain SQL, plus:\n\n- [PSR-3](https://www.php-fig.org/psr/psr-3/) compatible logging of database events.\n- Transparent caching of query results using any [PSR-6](https://www.php-fig.org/psr/psr-6/)\n  or [PSR-16](https://www.php-fig.org/psr/psr-16/) compliant caching implementation.\n- Easy protection against SQL injection attacks using prepared statements.\n- No-fuss serialization / unserialization of any valid PHP type.\n\nInterested? [Here's how to get started.](#getting-started)\n\n## FAQ\n\n### Why not write my own SQL queries directly?\n\nThe problem with plain old SQL is that \"SQL\" unfortunately does not refer to a single thing. Instead, it comes in\ndifferent \"flavors\", each of which have slight variations on their syntax and supported features. Nobody writes \"SQL\"\nqueries. You always have to target a specific flavor.\n\n*\"Okay, what if I only use SQL functions and syntax that are part of a universal SQL standard?\"*\n\nWhile there is such a thing as an SQL \"standard\" adopted by both [ANSI](https://ansi.org/) and [ISO](https://iso.org/),\nyou'll quickly face two problems when trying to write queries that comply with it:\n\n1. Some very basic functionality, such as that of the [MySQL](https://mysql.com/) `LIMIT` and `OFFSET` keywords, are\n   inexplicably missing from the standard instruction set. In such situations, you're forced to either rewrite your\n   query in hacky ways that try to accomplish the same result, or give up and only target a specific flavor, which\n   might (will) cause portability problems later on.\n\n2. Different SQL flavors comply with the standard to a wildly varying degree.\n   While [PostgreSQL](https://postgresql.org/) and [SQLite](https://sqlite.org/) are *mostly* compliant (at least, with\n   the core standard, disregarding the various extensions), you'll still come across small differences that break things\n   in very subtle ways that might otherwise go unnoticed. Trying to take these into account will add significant\n   overhead to development and will generally make it unmotivating to work on the backend infrastructure.\n\n*eufony/dbal* takes care of these problem for you. As an abstraction layer, you, as a developer, don't have to worry at\nall about the syntax that comes out the other end. If you want to migrate flavors, you only need to switch to any of the\nready-made [driver implementations](https://packagist.org/providers/eufony/dbal-driver-implemtation); or, if one doesn't\nexist, [contribute](#contributing) and [make your own](docs/Supporting_other_Databases.md). Additionally, you'll get to\nenjoy some creature comforts when interacting with your database from PHP; such as transparent logging, caching, and\nconversion between PHP and SQL data types.\n\n### Why not use a more well-established, mature project?\n\n*~~Because trusting your critical infrastructure to untested, unfunded, emerging projects is fun and exciting!~~*\n\nOn a more serious note, *eufony/dbal* was started as a sister project to [*eufony/orm*](https://github.com/eufony/orm),\nan [Object Relational Mapping](https://en.wikipedia.org/wiki/Object-relational_mapping) library that aims to rethink the\ndisadvantages of relational database models with an inventive pragmatic approach. It was concluded during early\ndevelopment that supporting multiple SQL flavors [was impractical](#why-not-write-my-own-sql-queries-directly) without\nan abstraction layer on top of SQL.\n\nAs such, the project was split into two, with *eufony/orm* providing the \"top\" and *eufony/dbal* providing the \"bottom\"\nhalves, in much the same way as other popular projects such as the [Doctrine ORM](https://github.com/doctrine/orm).\nUnlike the Doctrine project, however, *eufony/dbal* also tries to create an expressive syntax for using its query\nbuilders, as they are something that the end-user (you) can reasonably be expected to interact with.\n\n## Getting started\n\n### Installation\n\n*eufony/dbal* is released as a [Packagist](https://packagist.org/) package and can be easily installed\nvia [Composer](https://getcomposer.org/) with:\n\n    composer require \"eufony/dbal:v1.x-dev\"\n\n\u003e **Warning**: This package ***does not have any stable releases*** yet (not even a v0.x pre-release) and is currently\n\u003e ***unstable***. Expect frequent breaking changes and instability!\n\n### Basic Usage\n\n*For a more detailed documentation, see [here](docs).*\n\n*eufony/dbal* is a \"zero-configuration\" library, making it blazingly fast to get started. Just define a new database\nconnection and (optionally) give it a name, like so:\n\n```php\n$driver = /* ... */;\n$database = new Connection($driver, key: \"default\");\n```\n\nThe driver can be any implementation of the driver interface. Out of the box, *eufony/dbal* supports PostgreSQL, MySQL,\nand SQLite:\n\n```php\n// PostgreSQL\n$postgres = new PostgreSQLDriver($dsn, $user, $password);\n\n// MySQL\n$mysql = new MySQLDriver($dsn, $user, $password);\n\n// SQLite\n$sqlite = new SQLiteDriver($path); // $path can also be `:memory:` for an ephemeral database\n```\n\nAll three drivers use the PHP PDO extension under the hood.\n\nOnce your connection is activated, you can immediately start building and sending queries to the database:\n\n```php\n// Define the query\n$query = Select::from(\"users\");\n\n// You can also extend the query using loops, conditional logic, etc.\nif ($fetch_ids_only) {\n    $query = $query-\u003efields([\"id\"]);\n}\n\n// Generate the query string and send it to the database for execution\n$users = $query-\u003eexecute();\n```\n\nYou can find a list of example queries [here](docs/Queries.md).\n\n## Contributing\n\nFound a bug or a missing feature? Report it over at the [issue tracker](https://github.com/eufony/dbal/issues).\n\n## License\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public\nLicense as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later\nversion.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\ndetails.\n\nYou should have received a copy of the GNU Lesser General Public License along with this program. If not,\nsee \u003chttps://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feufony%2Fdbal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feufony%2Fdbal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feufony%2Fdbal/lists"}