bendozy/orm

一个简单的、无差别的PHP ORM

dev-master 2015-10-21 12:32 UTC

This package is not auto-updated.

Last update: 2024-10-02 17:57:16 UTC


README

Build Status

#Simple ORM 一个简单的轻量级PHP对象关系映射器(ORM),按照 PHP League方式 实现

#测试 使用phpunit框架进行测试,对类进行单元测试。采用了TDD原则

在bash中运行以下命令以执行测试

/vendor/phpunit/phpunit/phpunit

#安装

  • 要安装此包,需要PHP 5.5.9+和Composer
composer require bendozy/orm

#使用方法

  • 保存记录到数据库
$user = new User();
$user->username = "Marcus";
$user->password = "password";
$user->email = "Marcus@andela.com";
$user->save();
  • 查找记录
$user = User::find($id);
  • 更新记录
$user = User::find($id);
$user->password = "passwordagain";
$user->username = "helloandela";
$user->save();

  • 删除记录 -- 返回布尔值
$result = User::destroy($id):
  • 根据列值查找记录
$user = User::where('username', 'john');
``````



## Change log
Please refer to [CHANGELOG](CHANGELOG.mds) file for information on what has changed recently.

## Contributing
Please check out [CONTRIBUTING](CONTRIBUTING.md) file for detailed contribution guidelines.

## Credits
Simple ORM is maintained by [Chidozie Ijeomah](https://github.com/andela-cijeomah).

## License
Simple ORM is released under the MIT Licence. See the bundled [LICENSE](LICENSE.md) file for details.