PHPackages                             jimwins/titi - 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. jimwins/titi

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

jimwins/titi
============

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP, plus a lightweight ActiveRecord implementation

v0.0.7(2y ago)32.7k1BSD-2-ClausePHPPHP &gt;=5.6.0

Since May 17Pushed 2y ago2 watchersCompare

[ Source](https://github.com/jimwins/titi)[ Packagist](https://packagist.org/packages/jimwins/titi)[ Docs](https://trainedmonkey.com/projects/titi/)[ GitHub Sponsors](https://github.com/jimwins)[ RSS](/packages/jimwins-titi/feed)WikiDiscussions main Synced today

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

Titi
====

[](#titi)

[![Build Status](https://camo.githubusercontent.com/57ed84015544652f3ef1c519242df020125a2e164ae1260caee5b287c57b9f8a/68747470733a2f2f6170702e7472617669732d63692e636f6d2f6a696d77696e732f746974692e7376673f6272616e63683d6d61696e)](https://app.travis-ci.com/github/jimwins/titi)

Titi is a lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP, plus a lightweight ActiveRecord implementation.

Titi was forked from [Idiorm and Paris](http://j4mie.github.io/idiormandparis/)(combined into a single repo).

---

Tested on PHP 8.1.16 and MySQL 8.0.32 - may work on earlier versions with PDO and the correct database drivers.

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

Features
--------

[](#features)

- Makes simple queries and simple CRUD operations completely painless.
- Gets out of the way when more complex SQL is required.
- Built on top of [PDO](http://php.net/pdo).
- Uses [prepared statements](http://php.net/manual/en/pdo.prepared-statements.php) throughout to protect against [SQL injection](http://en.wikipedia.org/wiki/SQL_injection) attacks.
- Requires no model classes, no XML configuration and no code generation: works out of the box, given only a connection string.
- Consists of one main class called `ORM`. Additional classes are prefixed with `Titi`. Minimal global namespace pollution.
- 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 supported
- PSR-1 compliant methods (any method can be called in camelCase instead of underscores eg. `find_many()` becomes `findMany()`) - you'll need PHP 5.3+

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

[](#documentation)

The documentation is hosted on Read the Docs: [titi.rtfd.io](https://titi.readthedocs.io/).

### Building the Docs

[](#building-the-docs)

You will need to install [Sphinx](http://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)

```
require 'vendor/autoload.php';

use \Titi\ORM;
use \Titi\Model;

$user = ORM::for_table('user')
    ->where_equal('username', 'j4mie')
    ->find_one();

$user->first_name = 'Jamie';
$user->save();

$tweets = ORM::for_table('tweet')
    ->select('tweet.*')
    ->join('user', array(
        'user.id', '=', 'tweet.user_id'
    ))
    ->where_equal('user.username', 'j4mie')
    ->find_many();

foreach ($tweets as $tweet) {
    echo $tweet->text;
}

/* ActiveRecord model */
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;
}
```

Tests
-----

[](#tests)

Tests are written with PHPUnit and be run through composer

```
composer test

```

To see the test progress and results:

```
composer -v test

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~229 days

Recently: every ~334 days

Total

7

Last Release

810d ago

PHP version history (3 changes)v0.0.1PHP &gt;=5.2.0

v0.0.3PHP &gt;=5.3.0

v0.0.5PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6aa424e4d13613599b99a4470c0e804f45b02b55ef75fbf9f1499817b87fa13a?d=identicon)[jimw](/maintainers/jimw)

---

Top Contributors

[![treffynnon](https://avatars.githubusercontent.com/u/65215?v=4)](https://github.com/treffynnon "treffynnon (317 commits)")[![j4mie](https://avatars.githubusercontent.com/u/6988?v=4)](https://github.com/j4mie "j4mie (201 commits)")[![jimwins](https://avatars.githubusercontent.com/u/329264?v=4)](https://github.com/jimwins "jimwins (41 commits)")[![charsleysa](https://avatars.githubusercontent.com/u/1219661?v=4)](https://github.com/charsleysa "charsleysa (15 commits)")[![lrlopez](https://avatars.githubusercontent.com/u/547387?v=4)](https://github.com/lrlopez "lrlopez (13 commits)")[![Lapayo](https://avatars.githubusercontent.com/u/1183538?v=4)](https://github.com/Lapayo "Lapayo (6 commits)")[![durhamhale](https://avatars.githubusercontent.com/u/621305?v=4)](https://github.com/durhamhale "durhamhale (6 commits)")[![stellis](https://avatars.githubusercontent.com/u/2069140?v=4)](https://github.com/stellis "stellis (5 commits)")[![sandermarechal](https://avatars.githubusercontent.com/u/145240?v=4)](https://github.com/sandermarechal "sandermarechal (4 commits)")[![moiseevigor](https://avatars.githubusercontent.com/u/993491?v=4)](https://github.com/moiseevigor "moiseevigor (4 commits)")[![CBeerta](https://avatars.githubusercontent.com/u/746999?v=4)](https://github.com/CBeerta "CBeerta (3 commits)")[![rotexdegba](https://avatars.githubusercontent.com/u/1242622?v=4)](https://github.com/rotexdegba "rotexdegba (3 commits)")[![Surt](https://avatars.githubusercontent.com/u/48085?v=4)](https://github.com/Surt "Surt (3 commits)")[![m92o](https://avatars.githubusercontent.com/u/140899?v=4)](https://github.com/m92o "m92o (2 commits)")[![gsouf](https://avatars.githubusercontent.com/u/3215399?v=4)](https://github.com/gsouf "gsouf (2 commits)")[![ptarjan](https://avatars.githubusercontent.com/u/40143?v=4)](https://github.com/ptarjan "ptarjan (2 commits)")[![falmp](https://avatars.githubusercontent.com/u/94873?v=4)](https://github.com/falmp "falmp (2 commits)")[![jahvi](https://avatars.githubusercontent.com/u/661330?v=4)](https://github.com/jahvi "jahvi (2 commits)")[![JoelMarcey](https://avatars.githubusercontent.com/u/3757713?v=4)](https://github.com/JoelMarcey "JoelMarcey (2 commits)")[![limenet](https://avatars.githubusercontent.com/u/474329?v=4)](https://github.com/limenet "limenet (2 commits)")

---

Tags

activerecordormpdophpphp-librarysqlormquery builderactiverecordidiormparistiti

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jimwins-titi/health.svg)

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

###  Alternatives

[j4mie/idiorm

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5

2.0k1.5M29](/packages/j4mie-idiorm)[cycle/orm

PHP DataMapper ORM and Data Modelling Engine

1.3k835.4k65](/packages/cycle-orm)[php-activerecord/php-activerecord

php-activerecord is an open source ORM library based on the ActiveRecord pattern.

1.3k397.8k21](/packages/php-activerecord-php-activerecord)[j4mie/paris

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

989499.6k22](/packages/j4mie-paris)[nilportugues/sql-query-builder

An elegant lightweight and efficient SQL QueryInterface BuilderInterface supporting bindings and complicated query generation.

425239.4k6](/packages/nilportugues-sql-query-builder)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)

PHPackages © 2026

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