florence/potato
Composer 安装命令:
composer require florence/potato
包简介
Potato ORM is a simple agnostic ORM that can perform the basic crud database operations
README 文档
README
Potato ORM
Potato ORM is a simple and very basic ORM that can perform the basic crud database operations.
Installation
Require via composer:
composer require florence/potato
Usage
- make sure to establish a connection to your database
- create your database tables using pluralized names e.g users, cars.
- define the table schema e.g users table schema could look like 👉 [username, email, password, phone]
- when the above is set, you can start using potatoORM
Example
-
create a model
class User extends Model { // add methods that are not available in parent class } -
create a new instance of the model you created
$user = new User(); -
add the respective column names and assign values
$user->username = "johndoe"; $user->email = "john@doe.com"; $user->phone = "08067890986"; -
save
$user->save(); -
fetch all users
$user = User::getAll(); -
find one user
$user = User::find(1); -
delete one user
$user = User::destroy(1); -
update user record
&user = User::find(3); $user->username = "Lindsay"; $user->email = "lindsay@africa.com"; $user->save();
Potato ORM is an open-source project and still pretty much work in progress. It does not handle table relationships as at this version and can only carry out simple crud operations. Please feel free to contribute to make this as awesome as it can get.
Happy Coding!
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-25