承接 andela-aonyango/potato-orm 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

andela-aonyango/potato-orm

Composer 安装命令:

composer require andela-aonyango/potato-orm

包简介

A lightweight ORM built using PHP and PDO.

README 文档

README

potato-orm

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

A light-weight ORM which allows you to insert records into a database, retrieve them, update them, and delete them.

Install

Via Composer

$ composer require andela-aonyango/potato-orm

In the package directory, run

$ composer install

Usage

Edit the example .env provided in the root of this package with the database settings you will use (make sure you .gitignore YOUR .env file). The one given uses MYSQL settings. PDO supports many database drivers so you can get familiar with what are valid/invalid inputs for the DSN and so on.

Sample Table

create table Person (
    id int unsigned auto_increment primary key,
    first_name varchar(30) not null,
    last_name varchar(30) not null,
    age int(2),
    gender varchar(7)
);

Sample Usage

<?php
// Example usage of this ORM

require "vendor/autoload.php";

use PotatoORM\Models\Person;

$person = new Person();
$person->first_name = "yua";
$person->last_name = "madha";
$person->age = 73;

// the add() method inserts an object and returns the last inserted id
$id = $person->add();

// retrieve the just-added person
$test = $person->find($id);

print_r($test);

$test->gender = "female";
$test->update();

// is the update successful
print_r($test->find($id));

// delete the person from the database
$test->remove();

// retrieve all people
print_r($person->findAll());
?>

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email andrew.onyango@andela.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固