PHPackages                             dennisvanbeersel/propel - 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. dennisvanbeersel/propel

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

dennisvanbeersel/propel
=======================

Propel2 is an open-source Object-Relational Mapping (ORM) for PHP.

00PHPCI passing

Since Jan 13Pushed 1mo agoCompare

[ Source](https://github.com/dennisvanbeersel/Propel)[ Packagist](https://packagist.org/packages/dennisvanbeersel/propel)[ RSS](/packages/dennisvanbeersel-propel/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (4)Used By (0)

Propel2
=======

[](#propel2)

Propel2 is an open-source Object-Relational Mapping (ORM) for PHP. It provides Active Record-style persistence and a fluent query builder, generating typed PHP model classes from an XML schema.

[![Github actions Status](https://github.com/propelorm/Propel2/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/propelorm/Propel2/actions/workflows/ci.yml?query=branch%3Amaster)[![codecov](https://camo.githubusercontent.com/3621f9971cf2f35ed2af28abca5ab0d9d4d0c4dfa24af1ac5ce79ee3fe5e69fa/68747470733a2f2f636f6465636f762e696f2f67682f70726f70656c6f726d2f50726f70656c322f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4c3174684642396e4f47)](https://codecov.io/gh/propelorm/Propel2)[![PHPStan](https://camo.githubusercontent.com/ff9142aa79e58bd482fac3aff00d4bea75e9b4a0e2f4908bb26d1b7f5df3a5ab/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230372d627269676874677265656e2e7376673f7374796c653d666c6174)](https://phpstan.org/)[![Code Climate](https://camo.githubusercontent.com/607261ab8b24b6127bc6f5467297d8bb0d96fd1fe9513bb3b85d6b94b1124868/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f70726f70656c6f726d2f50726f70656c322f6261646765732f6770612e737667)](https://codeclimate.com/github/propelorm/Propel2)[![Minimum PHP Version](https://camo.githubusercontent.com/30bbb243688cbc50d4ea30e2e11f2d98338a2c08b067d019a09ecc7e66a18cc4/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e342d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/7be9068adde0caf9d852b484dc77ea48bfca916ecfb2353a9492f2e484c0b41c/68747470733a2f2f706f7365722e707567782e6f72672f70726f70656c2f70726f70656c2f6c6963656e73652e737667)](https://packagist.org/packages/propel/propel)[![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/propelorm/Propel)

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

[](#requirements)

- **PHP 8.4+**, with `declare(strict_types=1)` in every source file
- **PDO** with drivers for your database of choice
- **Symfony 7.2+** components and **Composer** for dependency management

### Compatibility Matrix

[](#compatibility-matrix)

PropelPHPMySQLMariaDBPostgreSQLSymfony2.x (LTS, security only)8.35.7+10.4+12+7.0+3.08.38.0+10.5+14+7.2+**4.0 (this branch)****8.4**8.0+10.5+14+7.2+### Supported Databases

[](#supported-databases)

- MySQL 8.0+ / MariaDB 10.5+
- PostgreSQL 14+
- SQLite (kept for tests and small projects; frozen at its existing feature surface)

Oracle and SQL Server (mssql/sqlsrv) are no longer supported. See [docs/MIGRATION-FROM-PRE-AI.md](docs/MIGRATION-FROM-PRE-AI.md) if you are upgrading from a Propel project that used them.

### Symfony Components (^7.2)

[](#symfony-components-72)

Propel uses the following Symfony Components:

- [Config](https://github.com/symfony/config)
- [Console](https://github.com/symfony/console)
- [Filesystem](https://github.com/symfony/filesystem)
- [Finder](https://github.com/symfony/finder)
- [Translation](https://github.com/symfony/translation)
- [Validator](https://github.com/symfony/validator)
- [Yaml](https://github.com/symfony/yaml)

Propel relies on [**Composer**](https://github.com/composer/composer) to manage dependencies.

Installation
------------

[](#installation)

Read the [Propel documentation](http://propelorm.org/documentation/01-installation.html).

What's new in 4.0
-----------------

[](#whats-new-in-40)

Propel 4.0 is a ground-up modernization targeting PHP 8.4. The public Active Record / query API (the "Tier 1" surface) stays frozen and additive — existing `find()`, `filterBy*()`, `setX()` code keeps working — while the internals, generated code, and tooling were rewritten. The headline changes:

### PHP 8.4 baseline, strict types everywhere

[](#php-84-baseline-strict-types-everywhere)

Every source file declares `strict_types=1` and generated model classes are fully typed: typed column properties, `: self` setters, typed-nullable foreign-key getters, and `: static` query factories. ENUM columns generate backed PHP enums, and `__serialize`/`__unserialize` replace the old `__sleep`/`__wakeup` pair.

### Asymmetric property visibility on generated entities

[](#asymmetric-property-visibility-on-generated-entities)

Generated typed column properties moved from `protected` to `public protected(set)`. Reads are free from anywhere; writes are restricted to the entity class hierarchy, so external direct writes now fail fast instead of silently no-op'ing on a protected property:

```
// 4.0 generated base class:
abstract class Author
{
    public protected(set) ?int $id = null;
    public protected(set) ?string $firstName = null;
}

echo $author->id;        // reads work everywhere
$author->setFirstName(); // writes go through setters
```

### Connection decorator architecture

[](#connection-decorator-architecture)

The legacy mixed-responsibility `ConnectionWrapper` was decomposed into a stack of single-responsibility decorators under `Propel\Runtime\Connection\Internal\*`: `TransactionalConnection` (nested-transaction accounting), `LoggingConnection`(PSR-3 logging without per-query `debug_backtrace`), `CachingConnection` (a bounded-LRU prepared-statement cache), and the optional `ProfilingConnection`and `ReplicaRoutingConnection`. `ConnectionFactory` is the single source of truth for the canonical chain order. See [docs/CONNECTION-DECORATORS.md](docs/CONNECTION-DECORATORS.md).

### Primary / replica routing

[](#primary--replica-routing)

Master/slave terminology and config are gone. Connection management is now `ConnectionManagerPrimaryReplica`, configured with `primary:` / `replicas:` keys, plus additive query hints `Criteria::forcePrimary()` and `Criteria::allowReplica()`for per-query routing control with session-consistency and primary-fallback awareness.

### Streaming and lazy hydration

[](#streaming-and-lazy-hydration)

`ModelCriteria::findStream()` returns a `Generator` that yields one hydrated object per row as the database cursor walks, keeping memory roughly O(1) in row count instead of materializing the whole collection:

```
foreach ($query->findStream() as $book) {
    // one Book at a time; the full result set is never held in memory
}
```

Opt-in lazy relation objects (``) defer per-relation collection construction using PHP 8.4 lazy ghosts, materializing on first read.

### Modern enums for the query builder

[](#modern-enums-for-the-query-builder)

`Comparison`, `JoinType`, `SortOrder`, and `LogicalOperator` backed enums live under `Propel\Runtime\ActiveQuery\Operator\*` alongside (never replacing) the frozen `Criteria::*` constants. `Criteria::customCondition()` provides a parameterized successor to raw `Criteria::CUSTOM` SQL injection.

### Observability SPI

[](#observability-spi)

A `TelemetryInterface` SPI ships with a no-op default plus optional OpenTelemetry and Prometheus adapters (installed via Composer `suggest`), and a `CompositeTelemetry` to fan out to several at once. The connection decorators emit query spans, cache hit/miss counters, transaction-depth, hydration duration, and replica-routing metrics through it. See [docs/TELEMETRY.md](docs/TELEMETRY.md).

### Tooling and cleanup

[](#tooling-and-cleanup)

Console commands use Symfony's `#[AsCommand]` attribute, the migration tracking table was redesigned with `migration_name` / `batch` / `checksum` columns and SHA-256 drift detection, and `#[\Override]` is applied across the codebase. Legacy cruft was removed: `DebugPDO`/`PropelPDO`, `ConnectionManagerMasterSlave`, the NestedSet behavior, MyISAM plumbing, the XSLT pipeline, and the Validate / QueryCache behaviors.

### Upgrading

[](#upgrading)

A Rector rule set (in the `rector/` package) automates most call-site rewrites — PDO wrapper replacements, master/slave config and class renames, and others. See [docs/UPGRADE-4.0.md](docs/UPGRADE-4.0.md) for the full migration guide, and [docs/UPGRADE-3.0.md](docs/UPGRADE-3.0.md) / [docs/MIGRATION-FROM-PRE-AI.md](docs/MIGRATION-FROM-PRE-AI.md)when coming from older versions.

Development
-----------

[](#development)

### Running Tests

[](#running-tests)

```
# Run all tests (requires database setup)
composer test

# Run database-agnostic tests only (no database required)
composer test:agnostic

# Run tests for a specific database
composer test:mysql
composer test:pgsql
```

Set up the test database before running database-specific tests:

```
tests/bin/setup.sqlite.sh   # SQLite
tests/bin/setup.mysql.sh    # MySQL (requires DB_USER, DB_PW env vars)
tests/bin/setup.pgsql.sh    # PostgreSQL
```

### Code Quality

[](#code-quality)

```
# Full suite: tests + cs-check + PHPStan + Psalm + deptrac
composer testsuite

# Code style check / fix
composer cs-check
composer cs-fix

# Static analysis (PHPStan level 7)
composer stan

# Psalm analysis
composer psalm

# Architecture rules (deptrac)
composer deptrac
```

Contribute
----------

[](#contribute)

Everybody is welcome to contribute to Propel! Just [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and [create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

**Requirements for contributions:**

- Use `declare(strict_types=1)` in all PHP files
- Follow [Spryker coding standards](https://github.com/spryker/code-sniffer) (extended from PSR-12)
- Pass PHPStan level 7 analysis
- Include unit tests for your changes

Have a look at the [test suite guide](http://propelorm.org/documentation/cookbook/working-with-test-suite.html) for more details about test development in Propel.

Thank you!

License
-------

[](#license)

MIT. See the `LICENSE` file for details.

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance59

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3aa4a8338c83cf0e75d2ac8f6bca5804837f668e49f6fdacf5fc6a957429db45?d=identicon)[Kibbab](/maintainers/Kibbab)

---

Top Contributors

[![fzaninotto](https://avatars.githubusercontent.com/u/99944?v=4)](https://github.com/fzaninotto "fzaninotto (1239 commits)")[![willdurand](https://avatars.githubusercontent.com/u/217628?v=4)](https://github.com/willdurand "willdurand (771 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (336 commits)")[![dennisvanbeersel](https://avatars.githubusercontent.com/u/1997741?v=4)](https://github.com/dennisvanbeersel "dennisvanbeersel (271 commits)")[![marcj](https://avatars.githubusercontent.com/u/450980?v=4)](https://github.com/marcj "marcj (151 commits)")[![Incognito](https://avatars.githubusercontent.com/u/379322?v=4)](https://github.com/Incognito "Incognito (118 commits)")[![mringler](https://avatars.githubusercontent.com/u/9800945?v=4)](https://github.com/mringler "mringler (94 commits)")[![jaugustin](https://avatars.githubusercontent.com/u/564420?v=4)](https://github.com/jaugustin "jaugustin (94 commits)")[![cristianoc72](https://avatars.githubusercontent.com/u/865437?v=4)](https://github.com/cristianoc72 "cristianoc72 (70 commits)")[![ikeyan](https://avatars.githubusercontent.com/u/8082735?v=4)](https://github.com/ikeyan "ikeyan (66 commits)")[![oojacoboo](https://avatars.githubusercontent.com/u/764664?v=4)](https://github.com/oojacoboo "oojacoboo (46 commits)")[![robin850](https://avatars.githubusercontent.com/u/354185?v=4)](https://github.com/robin850 "robin850 (43 commits)")[![gharlan](https://avatars.githubusercontent.com/u/330436?v=4)](https://github.com/gharlan "gharlan (38 commits)")[![PhilinTv](https://avatars.githubusercontent.com/u/376033?v=4)](https://github.com/PhilinTv "PhilinTv (26 commits)")[![Big-Shark](https://avatars.githubusercontent.com/u/646054?v=4)](https://github.com/Big-Shark "Big-Shark (25 commits)")[![nederdirk](https://avatars.githubusercontent.com/u/778965?v=4)](https://github.com/nederdirk "nederdirk (25 commits)")[![bezpiatovs](https://avatars.githubusercontent.com/u/68903876?v=4)](https://github.com/bezpiatovs "bezpiatovs (22 commits)")[![themouette](https://avatars.githubusercontent.com/u/245501?v=4)](https://github.com/themouette "themouette (19 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (18 commits)")[![K-Phoen](https://avatars.githubusercontent.com/u/66958?v=4)](https://github.com/K-Phoen "K-Phoen (17 commits)")

### Embed Badge

![Health badge](/badges/dennisvanbeersel-propel/health.svg)

```
[![Health](https://phpackages.com/badges/dennisvanbeersel-propel/health.svg)](https://phpackages.com/packages/dennisvanbeersel-propel)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
