Github: https://github.com/wugang8068/RealRap
安装方法:
composer require csitc/real-rap dev-master
欢迎大家进行fork, 如果给我一个star, 我会更加努力维护的哦;
ORM有什么好处, 想必各位都大概知道了, ORM可以方便我们查找数据更加便捷,只需要去维护模型之间的关系, 而不需要去处理各种复杂的SQL语句,RealRap彻底抛弃CI_Model, 使用更抽象的\RealRap\Model作为模型父类。 底层的sql查询还是采用CI_DB_query_builder的AR。可以看做是对DB的一层封装吧。 相对于Laravel的Eloquent来说,无需配置Connection,直接复用CI的DB Connection。目前支持单个模型的CRUD,还不支持模型关联等复杂的关系逻辑。后面会慢慢完善这个项目。我是一名PHP小菜,还请各位大神勿喷,缺点还请大家赐教。
以下是英文介绍, 鄙人英文很low ,将就看一下吧;
RealRap
This is a CI ORM, and inspired by laravel eloquent
Retrieve
Example: We need to fetch the user where user_id >= 50 and order by user_id and user_mobile and get the first one
$users = User::all(['*'])->where([
'user_id <=' => 50]
)->order([
'user_id' => 'desc',
'user_mobile' => 'desc'])
->limit(1)->getOne();
The result mybe like this:
{
"id":50,
"user_nick_name":"18386053521",
"user_device_id":"B86E62AC-5FC4-45E3-A3F0-EB4544DB135D",
"user_mobile":"17288",
"user_create_date":"2016-07-10 09: