© 2010 Jason Frame [ jason@onehackoranother.com / @jaz303 ]
Released under the MIT License.
This is pretty experimental stuff and barely working.
- base-php
- phake
- superload
- Clone the main
spitfire
repo, and any of its dependencies you're going to want to change - Copy the
dev-bootstrap
script from thespitfire
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.
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();
?>