Medoo 高效 轻量级PHP数据库框架
Medoo Main Features
Lightweight – 32KB around with only one file.
Easy – Extremely easy to learn and use, friendly construction.
Powerful – Supports various common and complex SQL queries, data mapping, and prevent SQL injection.
Compatible – Supports all SQL databases, including MySQL, MSSQL, SQLite, MariaDB, Sybase, Oracle, PostgreSQL and more.
Friendly – Works well with every PHP frameworks, like Laravel, Codeigniter, Yii, Slim, and framework which supports singleton extension.
Free – Under MIT license, you can use it anywhere if you want.
https://medoo.in/ 官网
http://medoo.lvtao.net/doc.php 中文帮助
一个例子
// 引入 Medoo
require_once ‘medoo.php’;
$database = new medoo([
// 必须配置项
'database_type' => 'mysql',
'database_name' => 'name',
'server' => 'localhost',
'username' => 'your_username',
'password' => 'your_password',
'charset' => 'utf8',
// 可选参数
'port' => 3306,
// 可选,定义表的前缀
'prefix' => 'PREFIX_',
// 连接参数扩展, 更多参考 http://www.php.net/manual/en/pdo.setattribute.php
'option' => [
PDO::ATTR_CASE => PDO::CASE_NATURAL
]
]);
$database->insert("account", [
"user_name" => "foo",
"email" => "foo@bar.com"
]);