定制 tonix-tuft/reactphp-mysql-decorator 二次开发

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

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

tonix-tuft/reactphp-mysql-decorator

Composer 安装命令:

composer require tonix-tuft/reactphp-mysql-decorator

包简介

A decorator of the ReactPHP MySQL connection interface which augments its behaviour, e.g. providing binding of associative parameters.

README 文档

README

A decorator of the ReactPHP MySQL connection interface which augments its behaviour, e.g. providing binding of associative parameters.

Installation

Using Composer:

composer require tonix-tuft/reactphp-mysql-decorator

Usage

Currently, the only available decorator is BindAssocParamsConnectionDecorator, which provides the binding of associative parameters like in standard PHP PDO objects.

BindAssocParamsConnectionDecorator

This decorator allows the binding of associative parameters in queries (named parameters). To use it just wrap a React\MySQL\ConnectionInterface:

<?php

// ...
use React\EventLoop\Factory as LoopFactory;
use React\MySQL\Factory;
use ReactPHP\MySQL\Decorator\BindAssocParamsConnectionDecorator;

// ...
$loop = LoopFactory::create();
$factory = new Factory($loop);

$uri = 'username:password@localhost/dbname';
$connection = $factory->createLazyConnection($uri); // returns a React\MySQL\ConnectionInterface

$connectionWithBindAssocParams = new BindAssocParamsConnectionDecorator($connection);

// Now you can bind associative parameters when you execute your queries.
$value = 123;
$connectionWithBindAssocParams->query('SELECT * FROM table WHERE field = :value', [
   ':value' => $value
])->then(
   // ...
);

Acknowledgements

friends-of-reactphp/mysql - Async MySQL database client for ReactPHP.

License

MIT © Anton Bagdatyev (Tonix)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固