{"id":21157089,"url":"https://github.com/initorm/dbal","last_synced_at":"2026-07-12T13:31:51.356Z","repository":{"id":211617424,"uuid":"729586708","full_name":"InitORM/DBAL","owner":"InitORM","description":"Lightweight, dependency-free PDO abstraction layer for PHP 8 — lazy connections, fluent result mapper, PSR-3 logging. MySQL, PostgreSQL, SQLite.","archived":false,"fork":false,"pushed_at":"2026-06-11T17:58:58.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-11T19:25:11.322Z","etag":null,"topics":["composer-package","data-mapper","database","database-abstraction-layer","dbal","initorm","mariadb","mysql","pdo","php","php8","postgresql","psr-3","sqlite"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/initorm/dbal","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/InitORM.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"muhammetsafak"}},"created_at":"2023-12-09T17:42:20.000Z","updated_at":"2026-06-11T18:01:08.000Z","dependencies_parsed_at":"2024-11-20T12:03:55.102Z","dependency_job_id":"69ef5f8a-18b8-41b3-914c-229ce25c7030","html_url":"https://github.com/InitORM/DBAL","commit_stats":null,"previous_names":["initorm/dbal"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/InitORM/DBAL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitORM%2FDBAL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitORM%2FDBAL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitORM%2FDBAL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitORM%2FDBAL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InitORM","download_url":"https://codeload.github.com/InitORM/DBAL/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InitORM%2FDBAL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35393398,"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-07-12T02:00:06.386Z","response_time":87,"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":["composer-package","data-mapper","database","database-abstraction-layer","dbal","initorm","mariadb","mysql","pdo","php","php8","postgresql","psr-3","sqlite"],"created_at":"2024-11-20T12:00:06.235Z","updated_at":"2026-07-12T13:31:51.346Z","avatar_url":"https://github.com/InitORM.png","language":"PHP","funding_links":["https://github.com/sponsors/muhammetsafak"],"categories":[],"sub_categories":[],"readme":"# InitORM DBAL\n\n[![PHPUnit](https://github.com/InitORM/DBAL/actions/workflows/phpunit.yml/badge.svg)](https://github.com/InitORM/DBAL/actions/workflows/phpunit.yml)\n[![Latest Stable Version](https://poser.pugx.org/initorm/dbal/v/stable)](https://packagist.org/packages/initorm/dbal)\n[![Total Downloads](https://poser.pugx.org/initorm/dbal/downloads)](https://packagist.org/packages/initorm/dbal)\n[![License](https://poser.pugx.org/initorm/dbal/license)](LICENSE)\n[![PHP Version Require](https://poser.pugx.org/initorm/dbal/require/php)](https://packagist.org/packages/initorm/dbal)\n\nA small, dependency-free database abstraction layer for PHP. `initorm/dbal`\ngives you a thin, lazily-connecting PDO wrapper and a fluent result mapper —\nnothing more.\n\nIt is part of the [InitORM](https://github.com/InitORM) stack, but it has no\nruntime dependencies and can be used on its own anywhere PDO can.\n\n## Highlights\n\n- **Lazy connections.** No socket is opened until the first query.\n- **Driver-aware DSN building.** MySQL/MariaDB, PostgreSQL, SQLite.\n- **Fluent result mapper.** `asAssoc()`, `asObject()`, `asClass()`,\n  `asLazy()`, `asArray()` / `asBoth()`.\n- **Type-aware binding.** `bool` → `PARAM_BOOL`, `int` → `PARAM_INT`,\n  `null` → `PARAM_NULL`, everything else → `PARAM_STR`.\n- **In-memory query log** for debugging hotspots.\n- **PSR-3 friendly logging.** Pass any `LoggerInterface`, a callable, a file\n  path, or anything with a `critical()` method.\n- **Transparent PDO forwarding.** Unknown method calls are forwarded to the\n  underlying `PDO` / `PDOStatement`, so `lastInsertId()`, `beginTransaction()`,\n  `closeCursor()`, etc. all work directly on the wrapper.\n\n## Installation\n\n```bash\ncomposer require initorm/dbal\n```\n\nRequirements: **PHP 8.0+** and the `pdo` extension, plus the driver\nextension for the database you target (`pdo_mysql`, `pdo_pgsql`,\n`pdo_sqlite`).\n\n## 60-second quick start\n\n```php\nuse InitORM\\DBAL\\Connection\\Connection;\n\n$db = new Connection([\n    'driver'   =\u003e 'mysql',\n    'host'     =\u003e '127.0.0.1',\n    'port'     =\u003e 3306,\n    'database' =\u003e 'shop',\n    'username' =\u003e 'app',\n    'password' =\u003e 'secret',\n    'charset'  =\u003e 'utf8mb4',\n]);\n\n// Read\n$user = $db-\u003equery('SELECT id, name FROM users WHERE id = :id', ['id' =\u003e 42])\n           -\u003easAssoc()\n           -\u003erow();\n\n// Write\n$db-\u003equery(\n    'INSERT INTO users (name, email) VALUES (:name, :email)',\n    ['name' =\u003e 'Alice', 'email' =\u003e 'alice@example.com']\n);\n$newId = (int) $db-\u003elastInsertId();      // forwarded to PDO\n```\n\n## Documentation\n\nFull docs live in [`docs/`](docs/):\n\n- [01 · Getting Started](docs/01-getting-started.md)\n- [02 · Connection](docs/02-connection.md)\n- [03 · Querying](docs/03-querying.md)\n- [04 · DataMapper](docs/04-data-mapper.md)\n- [05 · Transactions](docs/05-transactions.md)\n- [06 · Logging](docs/06-logging.md)\n- [07 · Factories \u0026 DI](docs/07-factories-and-di.md)\n- [08 · Exceptions](docs/08-exceptions.md)\n- [09 · Recipes](docs/09-recipes.md)\n\n## Testing\n\n```bash\ncomposer install\ncomposer test\n```\n\nThe suite runs against SQLite in-memory and finishes in well under a\nsecond.\n\n## Upgrading from 1.x\n\nSee [`UPGRADE.md`](UPGRADE.md). The notable breaking changes are: PHP ≥ 8.0,\n`src/` layout, `PDO::ATTR_PERSISTENT` defaults to `false`, `rows()` returns\n`[]` instead of `null` when empty, and `bind()` returns `PARAM_BOOL` for\nbooleans.\n\n## Contributing\n\nIssues and pull requests are welcome. Please:\n\n1. Open an issue first if you intend to make a non-trivial change.\n2. Make sure `composer test` is green.\n3. Cover new behaviour with a test under `tests/`.\n\nSee the organisation-wide [contribution guide](https://github.com/InitORM/.github/blob/master/CONTRIBUTING.md)\nfor the full process.\n\n## License\n\n[MIT](LICENSE) © Muhammet ŞAFAK\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitorm%2Fdbal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finitorm%2Fdbal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finitorm%2Fdbal/lists"}