简约的的PHP5数据库工具包:Idiorm

jopen 11年前

Idiorm是一个简约的的PHP5数据库工具包。一个轻量级的近乎零配置的对象关系映射器和流畅的查询生成器。

功能特性:

  • 让简单的查询和简单的CRUD操作变得很简易。
  • Gets out of the way when more complex SQL is required.
  • Built on top of PDO.
  • Uses prepared statements throughout to protect against SQL injection attacks.
  • Requires no model classes, no XML configuration and no code generation: works out of the box, given only a connection string.
  • Consists of one main class called ORM. Additional classes are prefixed with Idiorm. Minimal global namespace pollution.
  • Database agnostic. Currently supports SQLite, MySQL, Firebird and PostgreSQL. May support others, please give it a try!
  • Supports collections of models with method chaining to filter or apply actions to multiple results at once.
  • Multiple connections supported
  • PSR-1 compliant methods (any method can be called in camelCase instead of underscores eg. find_many() becomes findMany()) - you'll need PHP 5.3+

$user = ORM::for_table('user')      ->where_equal('username', 'j4mie')      ->find_one();    $user->first_name = 'Jamie';  $user->save();    $tweets = ORM::for_table('tweet')      ->select('tweet.*')      ->join('user', array(          'user.id', '=', 'tweet.user_id'      ))      ->where_equal('user.username', 'j4mie')      ->find_many();    foreach ($tweets as $tweet) {      echo $tweet->text;  }

项目主页:http://www.open-open.com/lib/view/home/1388492182016