Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
experimental ActiveRecord-style ORM/code generator for PHP
PHP
tree: 7be541dc62
Failed to load latest commit information.
backend
dev
runtime
DOCS
README.markdown
TODO
backend.php
dev-bootstrap
test.php

README.markdown

spitfire - a PHP ORM & code-generator

© 2010 Jason Frame [ jason@onehackoranother.com / @jaz303 ]
Released under the MIT License.

This is pretty experimental stuff and barely working.

Dependencies

  • base-php
  • phake
  • superload

Hacking

  • Clone the main spitfire repo, and any of its dependencies you're going to want to change
  • Copy the dev-bootstrap script from the spitfire project root to your filesystem
  • From the console, invoke ./dev-bootstrap your_github_username target_dir
  • A skeleton project will be set up in target_dir, preferring any dependencies you've cloned (for read/write access), and falling back to the original read-only versions.

Basic Concepts

A model class extends SpitfireModel, defines its properties, associations and validations via annotations, and contains a placeholder where the generated code should be inserted. A rough example:

<?php
/**
 * :model
 * :table = "users"
 * :belongs_to[] = ["account", {"class_name" => "Account"}]
 */
class User extends SpitfireModel
{
    /** 
     * :serial
     */
    protected $id;

    /**
     * :property
     * :required
     * :validate[] = ["match", "/^[a-z0-9_-]{3,}$/"]
     */
    protected $username;

    // SPITFIRE-BEGIN
    // SPITFIRE-END
}
?>

And then you compile it all like this:

<?php
require 'backend.php';

$builder = new spitfire\Builder;
$builder->add_file('../../app/models/TestModel.php');
$builder->add_file('../../app/models/Business.php');
$builder->build();
?>
Something went wrong with that request. Please try again.