Porte: Object Relational Mapping (ORM) in PHP

Porte has been designed to save time and to simplify the development of relational database applications written in PHP. Porte can retrieve, search and save objects without a single line of SQL. Porte deliver a natural and easy to use framework.

February 23th, 2008: Porte 0.2.2 released

Features

Quick exemple

Create a new group, associate it with a new user and save both.

Command: "php samples/home/quick_exemple.php"


class Group extends PorteRecord{
  public $config = array(
    'properties' => array(
      'name'=>array('size'=>50),
      'users'=>array( 'has_many' )
    )
  );
}
      
class User extends PorteRecord{
  public $config = array(
    'name'=>'Users',
    'primary_key'=>'id_user',
    'encoding'=>'utf8',
    'properties' => array(
      'id_user'=>array('int'=>11),
      'username'=>array('size'=>50),
      'password'=>array('size'=>50),
      'groups'=>array( 'has_many' )
  )
  );
}

Porte::$database = 'porte';
Porte::$porte = new Porte();

$group = new Group();
$group->table->update(array('drop'));
$group->setName('my group');

$user = new User();
$user->table->update(array('drop'));
$user->setUsername('my username')
  ->setPassword('my password')
  ->addGroup($group)
  ->save();

echo 'User id is '.$user->getIdUser()."\r\n";
echo 'Group id is '.$group->getId()."\r\n";

// User id is: 1
// Group id is: 1
      

PHP ORM