PHPackages                             arabcoders/database - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. arabcoders/database

ActiveLibrary[Database &amp; ORM](/categories/database)

arabcoders/database
===================

Standalone database toolkit for PDO with query building, ORM, schema migrations, and seeding.

1.0.0(1mo ago)026↑476.9%MITPHPPHP &gt;=8.4CI passing

Since Apr 7Pushed 1w agoCompare

[ Source](https://github.com/arabcoders/database)[ Packagist](https://packagist.org/packages/arabcoders/database)[ Docs](https://github.com/arabcoders)[ RSS](/packages/arabcoders-database/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (2)Used By (0)

Database Package
================

[](#database-package)

`arabcoders/database` is a standalone PHP database package for applications that want predictable PDO access, explicit SQL generation, and optional ORM, schema, and seeding tools.

You can use the whole package or adopt only the parts you need:

- `Connection` and `ConnectionManager` handle execution, transactions, retries, and multi-connection setups.
- `Query/*` provides builders for `SELECT`, `INSERT`, `UPDATE`, and `DELETE` statements.
- `Orm/*` maps attribute-based entities to repositories and relation loaders.
- `Schema/*` covers schema definitions, introspection, diffing, and SQL rendering.
- `Seeder/*` and `Commands/SeederService.php` support seeder discovery and execution.

Core Principles
---------------

[](#core-principles)

- The package favors explicit behavior. Query objects compile into SQL and bound parameters you can inspect.
- Entities remain regular PHP objects. Repositories hydrate public mapped properties and run named operations.
- SQL generation stays dialect-aware so the same API can target MySQL, PostgreSQL, or SQLite.
- Each module can be used independently, so you do not need to adopt the full stack.

Package Layout
--------------

[](#package-layout)

- `Attributes/` contains attributes for schema, ORM, migrations, and seeders.
- `Commands/` contains higher-level services for migration and seeder workflows.
- `Dialect/` contains DML dialects used by the query builder and `Connection`.
- `Orm/` contains metadata factories, repositories, relation loading, and relation writes.
- `Query/` contains query objects, conditions, compilers, and parameter handling.
- `Schema/` contains schema registries, introspection, diffing, SQL rendering, and blueprints.
- `Seeder/` contains seeder registries, dependency resolution, execution, and history tracking.
- `Transformer/` contains value transform helpers used during ORM reads and writes.
- `Validator/` contains validation attributes and rules used by the ORM.

Requirements
------------

[](#requirements)

- PHP 8.4+.
- A PDO driver for `mysql`, `pgsql`, or `sqlite`.

Quick Start
-----------

[](#quick-start)

The example below creates a connection, runs a query, and sets up an `OrmManager` for repository access.

```
