FuzzyRecord documentation

Last updated: 18th January 2009

Where to get FuzzyRecord:

Need help?

Drop me an email, and I'll see what I can do.

What is FuzzyRecord?

FuzzyRecord is an Object-Relational-Mapping (ORM) system for PHP applications, based on the Active record design pattern, most famously used in Ruby On Rails. It has a friendly API leveraging some of the new features in PHP 5.3 behind the scenes.

What is FuzzyRecord not?

FuzzyRecord is NOT a full framework for PHP. It only provides a mechanism for storing and querying model objects (objects that store your application's data).

Important note

FuzzyRecord should be considered a work in progress. Some features are incomplete, and it will contain bugs. The API is bound to change in some places in the future. Use at your own risk!

Requirements

  • PHP 5.3+ with PDO-MySQL and / or PDO-PGSQL extension (Earlier versions of PHP are NOT supported)
  • MySQL or PostgreSQL database server

Optional

Main features

  • Friendly Rails-like API (eg: $user->photos, User::find_by_email() etc)
  • Simple setup - many models will need no logic
  • Support for property validation (length, regex, email addresses etc)
  • File properties for storing files on a local disk
  • Handles relationships between objects, including cascade updates / deletes (currently one_to_many and belongs_to are supported)
  • Can be used with auto increment primary keys as well as non-integer and composite primary keys
  • Can cache model data in memory using a temporary store, and / or a persistent Memcached store
  • Explict or automatic transactions - rollback multiple actions across the DB and cache stores
  • Can generate a DB schema from your models
  • Based on PDO for DB portability
  • Includes lots of unit tests

Coming soon

  • Better documentation
  • Write more tests
  • Many to many relationships without a joining table model
  • Full-text searching
  • Support for multiple find clauses with the same operator + field (eg: find_all_by_email_like_and_email_like())
  • Support for other databases (SQLite?)

Possible future features

  • DB-native foreign key constraints
  • Auto-generated admin system