a tiny mvc framework for php using php-activerecord
1<?php
2require_once __DIR__ . '/../../ActiveRecord.php';
3
4// assumes a table named "books" with a pk named "id"
5// see simple.sql
6class Book extends ActiveRecord\Model { }
7
8// initialize ActiveRecord
9// change the connection settings to whatever is appropriate for your mysql server
10ActiveRecord\Config::initialize(function($cfg)
11{
12 $cfg->set_model_directory('.');
13 $cfg->set_connections(array('development' => 'mysql://test:test@127.0.0.1/test'));
14});
15
16print_r(Book::first()->attributes());
17?>