2017 © Pedro Peláez
 

library orm

An orm lib independence from thinkphp 5.1.0RC1

image

yaophp/orm

An orm lib independence from thinkphp 5.1.0RC1

  • Friday, October 6, 2017
  • by yaophp
  • Repository
  • 0 Watchers
  • 10 Stars
  • 10 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

About

An orm lib independence from ThinkPHP, (*1)

update to 5.1.0 RC1, (*2)

Installation

git clone  then composer install 

or, (*3)

composer require yaophp/orm

Usage

Demo.php

<?php
require "vendor/autoload.php";

use yaophp\Orm;
use think\Db;
use think\Model;

//your database config, more info in orm/src/config.php
Orm::config([
        'username' => 'yourusername', 
        'password' => 'yourpassword', 
        'database' => 'yourdatabase'
    ]);

//example 1:
var_dump(Db::query('select * from article where id = :id', ['id' => 1]));

//example 2:
// from 5.1.0 RC1 where expression not support array type 
// var_dump(Db::name('article')->where(['id' => 1])->find()); // wrong
var_dump(Db::name('article')->where('id', '=', 1)->find()); // right

//example 3:
//do not use the way "\think\Loader::model()" to get an instance of Model
class Article extends Model
{
    public function getId($id)
    {
        return $this->where('id', '=', 1)->find();
    }
}
$article = new Article();
var_dump($article->getId(1));

ThinkPHP (https://www.kancloud.cn/manual/thinkphp5_1/353997), (*4)

The Versions

06/10 2017

dev-master

9999999-dev

An orm lib independence from thinkphp 5.1.0RC1

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

by Avatar yaophp

orm database thinkphp active record yaophp

06/10 2017

v5.1.0-RC1

5.1.0.0-RC1

An orm lib independence from thinkphp 5.1.0RC1

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

by Avatar yaophp

orm database thinkphp active record yaophp