A MySQL Query Builder for effortlessly composing SQL statements with support for executing them against databases.
- Introduction
- Examples
- Running Tests
- Troubleshooting
- Changelog
Query Builder makes it effortless to create complex SQL statements from simple method calls. With support for escaping and aliasing, you'll never worry about injecting the wrong data into your database ever again.
Query Builder currently targets the MySQL version of the SQL specification.
@todo Add composer dependency for github.com/Dachande663/PHP-DB
$sql = Query::select(array('m.name', 'movie'), array('t.name', 'theatre_name'), 'visited_date')
->from(array('visits', 'v'))
->join(array('movies', 'm'))->on('v.movie_id', '=', 'm.id')
->join(array('theatres', 't'))->on('v.theatre_id', '=', 't.id')
->where('m.rating', '>=', 80)
->order_by('v.visited_date', 'DESC')
->limit(5)
->as_object('MovieVisit')
->sql();
phpunit tests
Please note the test suite is currently incomplete.
@todo
- [2012-12-08] Initial Version
- [2013-01-02] First Release