meioa/db

Simple database connection tool

v1.0.2 2025-06-21 12:25 UTC

This package is auto-updated.

Last update: 2025-06-26 05:39:35 UTC


README

A simple database connection tool in PHP

Installation

composer require meioa/db

Example

use Meioa\Db\Db;
$dbConfig = [
            'hostname'        =>  '127.0.0.1',            
            'database'        =>  'admin',          // 数据库名
            'username'        =>  'root',           // 用户名
            'password'        =>  '123123'          // 密码
            'hostport'        =>  '3306',           // 端口
            'charset'         =>  'utf8',           // 数据库编码
            ]
$db = new Db($dbConfig);
$sql = '';
$dbRes = $db->exec($sql);