PHPackages                             j4mie/paris - 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. j4mie/paris

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

j4mie/paris
===========

A lightweight Active Record implementation for PHP5, built on top of Idiorm

v1.5.6(9y ago)989499.6k—4.5%131[2 issues](https://github.com/j4mie/paris/issues)[2 PRs](https://github.com/j4mie/paris/pulls)20BSD-2-ClausePHPPHP &gt;=5.2.0CI failing

Since Nov 14Pushed 2y ago54 watchersCompare

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

READMEChangelog (8)Dependencies (2)Versions (14)Used By (20)

Paris
=====

[](#paris)

[![Build Status](https://camo.githubusercontent.com/5e8cd1a48230f57b81495abfb5aecd8ff7d883cb5ddfd703190ec6e62f6f7540/68747470733a2f2f7472617669732d63692e6f72672f6a346d69652f70617269732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/j4mie/paris) [![Latest Stable Version](https://camo.githubusercontent.com/6a6f7e51f9f56ef3d0a8256082a1b04995395557e6ccc8d2eb92456c26ebf1c8/68747470733a2f2f706f7365722e707567782e6f72672f6a346d69652f70617269732f762f737461626c652e706e67)](https://packagist.org/packages/j4mie/paris) [![Total Downloads](https://camo.githubusercontent.com/cc330aab7f80ea5b55ec07a1d39ec30dd56037bafd5471adb75b40cd42f9aad4/68747470733a2f2f706f7365722e707567782e6f72672f6a346d69652f70617269732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/j4mie/paris)

---

### In maintenance only mode

[](#in-maintenance-only-mode)

Idiorm and Paris are now considered to be feature complete as of version 1.5.0. Whilst they will continue to be maintained with bug fixes there will be no further new features added from this point on. This means that if a pull request makes breaking changes to the API or requires anything other than a patch version bump of the library then it will not be merged.

**Please do not submit feature requests or API breaking changes as they will be closed without ceremony.**

### Should I use Idiorm/Paris?

[](#should-i-use-idiormparis)

#### If you're starting a new project

[](#if-youre-starting-a-new-project)

It is not recommended that you use either Idiorm or Paris in new projects.

I recommend that you use the [Eloquent database library](https://github.com/illuminate/database) from [Laravel](https://laravel.com) as Taylor based it on Idiorm when he wrote it. This means that many of the same ideas are present there, but it is more actively maintained and has a more modern code style.

#### If you have existing projects based on Idiorm or Paris

[](#if-you-have-existing-projects-based-on-idiorm-or-paris)

You can continue to use both projects as they will continue to receive security patches and bug fixes. It is important to note that future versions of PHP may not be supported if changes they require would break backwards compatibility.

At this point you can either use another database library such as Eloquent from Laravel (see If you're starting a new project above) or you could decide to fork Idiorm and/or Paris to patch them with your own modifications.

### But, why?

[](#but-why)

For further information on the state of this project please see [j4mie/idiorm#360](https://github.com/j4mie/idiorm/issues/360)

---

A lightweight Active Record implementation for PHP5.

Built on top of [Idiorm](https://github.com/j4mie/idiorm/).

Tested on PHP 5.2.0+ - may work on earlier versions with PDO and the correct database drivers.

Released under a [BSD license](https://en.wikipedia.org/wiki/BSD_licenses).

Features
--------

[](#features)

- Extremely simple configuration.
- Exposes the full power of [Idiorm](https://github.com/j4mie/idiorm/)'s fluent query API.
- Supports associations.
- Simple mechanism to encapsulate common queries in filter methods.
- Built on top of [PDO](https://php.net/pdo).
- Uses [prepared statements](https://uk.php.net/manual/en/pdo.prepared-statements.php) throughout to protect against [SQL injection](https://en.wikipedia.org/wiki/SQL_injection) attacks.
- Database agnostic. Currently supports SQLite, MySQL, Firebird and PostgreSQL. May support others, please give it a try!
- Supports collections of models with method chaining to filter or apply actions to multiple results at once.
- Multiple connections are supported

Documentation
-------------

[](#documentation)

The documentation is hosted on Read the Docs: [paris.rtfd.org](https://paris.rtfd.org)

### Building the Docs

[](#building-the-docs)

You will need to install [Sphinx](https://sphinx-doc.org/) and then in the docs folder run:

```
make html

```

The documentation will now be in docs/\_build/html/index.html

Let's See Some Code
-------------------

[](#lets-see-some-code)

```
class User extends Model {
    public function tweets() {
        return $this->has_many('Tweet');
    }
}

class Tweet extends Model {}

$user = Model::factory('User')
    ->where_equal('username', 'j4mie')
    ->find_one();
$user->first_name = 'Jamie';
$user->save();

$tweets = $user->tweets()->find_many();
foreach ($tweets as $tweet) {
    echo $tweet->text;
}
```

Changelog
---------

[](#changelog)

#### 1.5.6 - released 2017-03-21

[](#156---released-2017-03-21)

- Allow IDE's to autocomplete when `foreach` over `find_many()` result \[[stratoss](https://github.com/stratoss)\] - [issue #128](https://github.com/j4mie/paris/pull/128)
- Document the @property PHPDoc comment for IDE autocomplete of model properties \[[Treffynnon](https://github.com/Treffynnon)\]

#### 1.5.5 - released 2016-12-14

[](#155---released-2016-12-14)

- Fix join table name not generated correctly \[[Ralphunter](https://github.com/Ralphunter)\] - [issue #109](https://github.com/j4mie/paris/pull/109)
- Add phpunit as dev dependency and composer script (`composer test`) to easily run tests \[[Treffynnon](https://github.com/Treffynnon)\]
- Global setting to allow static requests to avoid being forced in to using the namespace + class as the auto table name \[[michaelward82](https://github.com/michaelward82)\] - [issue #100](https://github.com/j4mie/paris/issues/100)
- Document conflict between static Model calling and auto\_prefix\_models \[[michaelward82](https://github.com/michaelward82)\] - [issue #102](https://github.com/j4mie/paris/issues/102)
- Added @method tags for magic methods \[[stellis](https://github.com/stellis)\] - [issue #104](https://github.com/j4mie/paris/issues/104)
- Add missing `__unset()` magic method \[[qyanu](https://github.com/qyanu)\] - [issue #106](https://github.com/j4mie/paris/issues/106)
- Remove PHP 5.2 from travis-ci containers to test against (**note** Idiorm still supports PHP 5.2 despite this) \[[Treffynnon](https://github.com/treffynnon)\]

#### 1.5.4 - released 2014-09-23

[](#154---released-2014-09-23)

- Corrects return value in docblock for 2 Model functions \[[michaelward82](https://github.com/michaelward82)\] - [issue #99](https://github.com/j4mie/paris/pull/99)

#### 1.5.3 - released 2014-06-25

[](#153---released-2014-06-25)

- Remove erroneously committed git merge backup file

#### 1.5.2 - released 2014-06-23

[](#152---released-2014-06-23)

- Paris incorrectly relying on old Idiorm version in the composer.json \[[ilsenem](https://github.com/ilsenem)\] - [issue #96](https://github.com/j4mie/paris/pull/96)

#### 1.5.1 - released 2014-06-22

[](#151---released-2014-06-22)

- Remove HHVM build target from travis-ci as there is a bug in HHVM

#### 1.5.0 - released 2014-06-22

[](#150---released-2014-06-22)

- Allows static calling of Model subclasses, ignoring namespace info during table name generation \[[michaelward82](https://github.com/michaelward82)\] - [issue #90](https://github.com/j4mie/paris/issues/90)
- Prevent invalid method calls from triggering infinite recursion \[[michaelward82](https://github.com/michaelward82)\] - [issue #75](https://github.com/j4mie/idiorm/issues/75)
- Allow chaining of the `set()` and `set_expr()` methods \[[naga3](https://github.com/naga3)\] - [issue #94](https://github.com/j4mie/paris/issues/94)
- Add HHVM to travis-ci build matrix \[[ptarjan](https://github.com/ptarjan)\] - [issue #81](https://github.com/j4mie/idiorm/issues/81)
- Improve join documentation \[[rhynodesigns](https://github.com/rhynodesigns)\] - [issue #92](https://github.com/j4mie/paris/issues/92)
- Improve code docblock \[[michaelward82](https://github.com/michaelward82)\] - [issue #91](https://github.com/j4mie/paris/issues/91)
- Improve code docblocks and whitespace \[[michaelward82](https://github.com/michaelward82)\] - [issue #93](https://github.com/j4mie/paris/issues/93)
- Improve connections documentation \[[kkeiper1103](https://github.com/kkeiper1103)\] - [issue #79](https://github.com/j4mie/paris/issues/79)

#### 1.4.2 - released 2013-12-12

[](#142---released-2013-12-12)

**Patch update to remove a broken pull request** - may have consequences for users of 1.4.0 and 1.4.1 that exploited the "`find_many()` now returns an associative array with the databases primary ID as the array keys" change that was merged in 1.4.0.

- Back out pull request/issue [\#133](https://github.com/j4mie/idiorm/pull/133) as it breaks backwards compatibility in previously unexpected ways (see Idiorm issues [\#162](https://github.com/j4mie/idiorm/pull/162), [\#156](https://github.com/j4mie/idiorm/issues/156) and [\#133](https://github.com/j4mie/idiorm/pull/133#issuecomment-29063108)) - sorry for merging this change into Paris - closes Idiorm [issue 156](https://github.com/j4mie/idiorm/issues/156)

#### 1.4.1 - released 2013-09-05

[](#141---released-2013-09-05)

- Increment composer.json requirement for Idiorm to 1.4.0 \[[michaelward82](https://github.com/michaelward82)\] - [Issue #72](https://github.com/j4mie/paris/pull/72)

#### 1.4.0 - released 2013-09-05

[](#140---released-2013-09-05)

- Call methods against model class directly eg. `User::find_many()` - PHP 5.3 only \[[Lapayo](https://github.com/Lapayo)\] - [issue #62](https://github.com/j4mie/idiorm/issues/62)
- `find_many()` now returns an associative array with the databases primary ID as the array keys \[[Surt](https://github.com/Surt)\] - see commit [9ac0ae7](https://github.com/j4mie/paris/commit/9ac0ae7d302f1980c95b97a98cbd6d5b2c04923f) and Idiorm [issue #133](https://github.com/j4mie/idiorm/issues/133)
- Add PSR-1 compliant camelCase method calls to Idiorm (PHP 5.3+ required) \[[crhayes](https://github.com/crhayes)\] - [issue #59](https://github.com/j4mie/idiorm/issues/59)
- Allow specification of connection on relation methods \[[alexandrusavin](https://github.com/alexandrusavin)\] - [issue #55](https://github.com/j4mie/idiorm/issues/55)
- Make tests/bootstrap.php HHVM compatible \[[JoelMarcey](https://github.com/JoelMarcey)\] - [issue #71](https://github.com/j4mie/idiorm/issues/71)
- belongs\_to doesn't work with $auto\_prefix\_models ([issue #70](https://github.com/j4mie/paris/issues/70))

#### 1.3.0 - released 2013-01-31

[](#130---released-2013-01-31)

- Documentation moved to [paris.rtfd.org](http://paris.rtfd.org) and now built using [Sphinx](http://sphinx-doc.org/)
- Add support for multiple database connections \[[tag](https://github.com/tag)\] - [issue #15](https://github.com/j4mie/idiorm/issues/15)
- Allow a prefix for model class names - see Configuration in the documentation - closes [issues #33](https://github.com/j4mie/paris/issues/33)
- Exclude tests and git files from git exports (used by composer)
- Implement `set_expr` - closes [issue #39](https://github.com/j4mie/paris/issues/39)
- Add `is_new` - closes [issue #40](https://github.com/j4mie/paris/issues/40)
- Add support for the new IdiormResultSet object in Idiorm - closes [issue #14](https://github.com/j4mie/paris/issues/14)
- Change Composer to use a classmap so that autoloading is better supported \[[javierd](https://github.com/javiervd)\] - [issue #44](https://github.com/j4mie/paris/issues/44)
- Move tests into PHPUnit to match Idiorm
- Update included Idiorm version for tests
- Move documentation to use Sphinx

#### 1.2.0 - released 2012-11-14

[](#120---released-2012-11-14)

- Setup composer for installation via packagist (j4mie/paris)
- Add in basic namespace support, see [issue #20](https://github.com/j4mie/paris/issues/20)
- Allow properties to be set as an associative array in `set()`, see [issue #13](https://github.com/j4mie/paris/issues/13)
- Patch in idiorm now allows empty models to be saved (j4mie/idiorm see [issue #58](https://github.com/j4mie/paris/issues/58))

#### 1.1.1 - released 2011-01-30

[](#111---released-2011-01-30)

- Fix incorrect tests, see [issue #12](https://github.com/j4mie/paris/issues/12)

#### 1.1.0 - released 2011-01-24

[](#110---released-2011-01-24)

- Add `is_dirty` method

#### 1.0.0 - released 2010-12-01

[](#100---released-2010-12-01)

- Initial release

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity61

Solid adoption and visibility

Community44

Growing community involvement

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 59.7% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~144 days

Recently: every ~250 days

Total

12

Last Release

3346d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aca88e0a99332b6532211cdcbeb22d7861f76eafc9158d33e50d2ce33eeebd6e?d=identicon)[Treffynnon](/maintainers/Treffynnon)

![](https://www.gravatar.com/avatar/42db5bfa900e18cda69687c5ff980f7fb662b30ab7be2c24a66d32c185f65e5d?d=identicon)[durhamhale](/maintainers/durhamhale)

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

---

Top Contributors

[![treffynnon](https://avatars.githubusercontent.com/u/65215?v=4)](https://github.com/treffynnon "treffynnon (114 commits)")[![j4mie](https://avatars.githubusercontent.com/u/6988?v=4)](https://github.com/j4mie "j4mie (56 commits)")[![Lapayo](https://avatars.githubusercontent.com/u/1183538?v=4)](https://github.com/Lapayo "Lapayo (6 commits)")[![rotexdegba](https://avatars.githubusercontent.com/u/1242622?v=4)](https://github.com/rotexdegba "rotexdegba (3 commits)")[![stellis](https://avatars.githubusercontent.com/u/2069140?v=4)](https://github.com/stellis "stellis (3 commits)")[![alexandrusavin](https://avatars.githubusercontent.com/u/1612455?v=4)](https://github.com/alexandrusavin "alexandrusavin (1 commits)")[![rhynodesigns](https://avatars.githubusercontent.com/u/2198266?v=4)](https://github.com/rhynodesigns "rhynodesigns (1 commits)")[![stratoss](https://avatars.githubusercontent.com/u/8927314?v=4)](https://github.com/stratoss "stratoss (1 commits)")[![Surt](https://avatars.githubusercontent.com/u/48085?v=4)](https://github.com/Surt "Surt (1 commits)")[![ptarjan](https://avatars.githubusercontent.com/u/40143?v=4)](https://github.com/ptarjan "ptarjan (1 commits)")[![jahvi](https://avatars.githubusercontent.com/u/661330?v=4)](https://github.com/jahvi "jahvi (1 commits)")[![JoelMarcey](https://avatars.githubusercontent.com/u/3757713?v=4)](https://github.com/JoelMarcey "JoelMarcey (1 commits)")[![kkeiper1103](https://avatars.githubusercontent.com/u/4206897?v=4)](https://github.com/kkeiper1103 "kkeiper1103 (1 commits)")[![naga3](https://avatars.githubusercontent.com/u/5917968?v=4)](https://github.com/naga3 "naga3 (1 commits)")

---

Tags

ormmodelactive-recordparis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/j4mie-paris/health.svg)

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

###  Alternatives

[propel/propel

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

1.3k5.3M110](/packages/propel-propel)[propel/propel1

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

8481.6M87](/packages/propel-propel1)[vlucas/spot2

Simple DataMapper built on top of Doctrine DBAL

605392.8k7](/packages/vlucas-spot2)[thecodingmachine/tdbm

The Database Machine is a PHP ORM that requires no configuration. The object model is deduced from the database model.

123174.9k6](/packages/thecodingmachine-tdbm)[cycle/active-record

Provides a simple way to work with your database using Active Record pattern and Cycle ORM

671.3k3](/packages/cycle-active-record)[ymigval/laravel-model-cache

Laravel package for caching Eloquent model queries

7642.2k3](/packages/ymigval-laravel-model-cache)

PHPackages © 2026

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