kola/potato-orm
Composer 安装命令:
composer require kola/potato-orm
包简介
This is an ORM package that manages the persistence of database CRUD operations.
关键字:
README 文档
README
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
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-07