kola/potato-orm 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kola/potato-orm

Composer 安装命令:

composer require kola/potato-orm

包简介

This is an ORM package that manages the persistence of database CRUD operations.

README 文档

README

Build Status Software License Latest Version on Packagist Total Downloads

This is an ORM package that manages the persistence of simple database CRUD operations.

Installation

PHP 5.5+ and Composer are required.

Via Composer

$ composer require kola/potato-orm
$ composer install

Usage

Create a class with the name of the corresponding table in the database. Extend the class to the base class Model under the namespace Kola\PotatoOrm.

For instance, a class for dogs or Dogs or dog or Dog table should look like this:

namespace Kola\PotatoOrm;

class Dog extends Model
{
}
  • Create and save a record to database
$dog = new Dog();
$dog->name = "Rex";
$dog->breed= "Alsatian";
$dog->origin = "Germany";
$dog->save();
  • Find and update a record in database
$dog = Dog::find(4);
$dog->name = "Bruno";
$dog->save();

OR

$dog = Dog::where('name', 'Rex');
$dog->breed = "Rottweiler";
$dog->save();
  • Delete a record
$dog = Dog::destroy(2);

Feel free to name the class as the singular of the name of the database table. For instance, User class for users table.

Note: Plurals of irregular nouns are not supported

For instance, a class Fish should map to a table fish or fishs, not fishes. And a class Child should map to a table child or childs, not children.

Supported database

Currently, only MYSQL and PostgreSQL are supported.

Work towards the support for other popular databases is in progress.

Change log

Please check out CHANGELOG file for information on what has changed recently.

Testing

$ vendor/bin/phpunit test

Contributing

Please check out CONTRIBUTING file for detailed contribution guidelines.

Credits

potato-orm is maintained by Kolawole ERINOSO.

License

potato-orm is released under the MIT Licence. See the bundled LICENSE file for details.

统计信息

  • 总下载量: 135
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-07