Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (18 sloc) 1.078 kb


Bella is a PHP project inspired by Arel. Bella has the same internal structure as Arel and has a very similar syntax to it as well. Check to see the tests perform.


  1. Clone
  2. Make sure bella is visible on server and target index.php for the unit tests.
  3. So far I can confirm that Bella runs on at least PHP 5.2.13.


The best place to check out examples is in the unit tests (bella/tests).

Simple Query

$users = new Table('users');
echo  $users->project('*')->to_sql();

// Result: SELECT * FROM users

$users = new Table('users');
$query = $users->where($users['name']->eq('bob')->otherwise($users['age']->lt(25)));

// Result: SELECT FROM users WHERE (name = 'bob' OR age < 25)

Keyword Conflicts

I had to rename to methods 'and' to 'also' and 'or' to 'otherwise'. This decision was made because PHP uses both keywords 'or' and 'and'.

If anyone finds words to better describe these methods message me.

Jump to Line
Something went wrong with that request. Please try again.