定制 basttyy/reactphp-orm 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

basttyy/reactphp-orm

最新稳定版本:v0.1.1

Composer 安装命令:

composer require basttyy/reactphp-orm

包简介

A database OMR for ReactPHP based on illuminate/database and react/mysql packages

README 文档

README

A database ORM for reactphp based on illuminate/database and react/mysql

Project Informations

Code Coverage

Installation

Use php package manager composer to install reactphp-orm.

composer require basttyy/reactphp-orm

Usage

<?php
//import
require './vendor/autoload.php';

use Basttyy\ReactphpOrm\QueryBuilderWrapper;
use Basttyy\ReactphpOrm\QueryBuilder;
use React\MySQL\Factory;
use React\MySQL\QueryResult;

#create react/mysql factory
$factory = new Factory();

#create querybuilder connection object
$connection = (new QueryBuilderWrapper($factory))->createLazyConnection('root:123456789@localhost/react-database');

#run an insert query
$values = [
    'username' => 'johndoe',
    'firstname' => 'john',
    'lastname' => 'doe',
    'email' => 'johndoe@mail.com'
];

$connection->from('users')->insert($values)->then(
    function (bool $status) {
        echo "inserted successfully ".PHP_EOL;
    },
    function (Exception $ex) {
        echo $ex->getMessage().PHP_EOL;
    }
);

#run a select where query
$connection->from('users')->where('status', 'active')->query()->then(
    function (QueryResult $command) {
        print_r($command->resultRows);
        echo count($command->resultRows) . ' row(s) in set' . PHP_EOL;
    },
    function (Exception $error) {
        echo 'Error: ' . $error->getMessage() . PHP_EOL;
    }
);

#run a get query
$connection->from('users')->where('status', 'active')->get()->then(
    function(Collection $data) {
        print_r($data->all());
        echo $data->count() . ' row(s) in set' . PHP_EOL;
    },
    function (Exception $error) {
        echo 'Error: ' . $error->getMessage() . PHP_EOL;
    }
);

Query Features Coverage Map

  • query()
  • get()
  • insert()
  • delete
  • Update
  • first()
  • find()
  • count
  • exists
  • InsertOrIgnore
  • InsertUsing
  • UpdateOrInsert
  • UpdateFrom
  • Upsert
  • pluck
  • doesntexist
  • existsor
  • doesntexistor
  • Increment
  • decrement
  • lock
  • lockforupdate
  • findor
  • value
  • paginate
  • simplepaginate
  • cursopaginate
  • getcountforpagination
  • getpaginationcountquery
  • cursor
  • min
  • max
  • sum
  • avg
  • average
  • aggregate
  • numericaggregate
  • truncate
  • newQuery
  • forSubQuery
  • getProcessor
  • useWritePDO
  • clone
  • cloneWithout
  • cloneWithoutBindings

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固