定制 itrn0/php-medoo-wrapper 二次开发

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

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

itrn0/php-medoo-wrapper

最新稳定版本:v1.1.2

Composer 安装命令:

composer require itrn0/php-medoo-wrapper

包简介

A wrapper for the Medoo library that allows for easy fetching of rows.

README 文档

README

This library extends Medoo's functionality with added methods for safer database interaction, including a SqlInterpolator class for safe variable interpolation and extended fetch methods.

Installation

You can install the library using composer:

composer require itrn0/php-medoo-wrapper

Usage

require __DIR__ . '/vendor/autoload.php';

use Itrn0\MedooWrapper\MedooWrapper;
use Itrn0\SqlInterpolator\SqlInterpolator;

$db = new MedooWrapper([
    'database_type' => 'mysql',
    'database_name' => 'test',
    'server' => 'localhost',
    'username' => 'root',
    'password' => ''
]);

$usernames = ['alice', 'bob'];
$res = $db->query(function (SqlInterpolator $interp) use ($usernames) {
    return <<<SQL
        SELECT * FROM users WHERE id IN ({$interp(...$usernames)})
    SQL;
});
$users = $res->fetchAll();

Fetching Data

You can fetch data using fetch and fetchAll methods.

// Fetch a single row from the query result set
$data = $db->fetch("SELECT * FROM `users` WHERE `name` = :name", [
    ':name' => 'John',
]);

// Returns an array containing all of the result set rows
$data = $db->fetchAll("SELECT * FROM `users`");

License

This library is licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固