PHP code example of easyswoole / orm

1. Go to this page and download the library: Download easyswoole/orm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

easyswoole / orm example snippets


 ./vendor/bin/co-phpunit tests

$model = Model::create()

//$op => = , > , < , != , in , between
$model->where(col1,val1,$op)->get()
$model->where(col1,100,">")->get()
$model->where(col1,100,"<")->get()
$model->where(col1,100,"=")->get()
$model->where(col1,[1,100],"in")->get()
$model->where(col1,[1,100],"between")->get()

$model->where(col1,val1)->where(col2,val2)->get()
=> select * from where col1 = val1 and col2 = val2 limit 1


// 数组形式传参 仅支持此种格式数组
$array1 = [
    ['user', 'easyswoole', '='],
    ['age', '18', '!='],
];
$array1 = [
    ['creaet_time', '2021-12-29 14:47:32', '='],
];
$model->where($array1)->where($array2)->get()


// TODO 兼容 原生sql