The Lightweight PHP Database Framework to Accelerate Development

Version: 2.1.12
download Fork me on GitHub
Build Status Total Downloads Latest Stable Version License Backers on Open Collective Sponsors on Open Collective
Lightweight

Portable with only one file.

Easy

Easy to learn and use, friendly construction.

Powerful

Supports various common and complex SQL queries, data mapping, and prevents SQL injection.

Compatible

Supports MySQL, MSSQL, SQLite, MariaDB, PostgreSQL, Sybase, Oracle, and more.

Friendly

Works well with every PHP framework, like Laravel, Yii, Slim, and framework which supports singleton extension or composer.

Free

Under the MIT license, you can use it anywhere, whatever you want.

Get Started

Composer require

$ composer require catfan/medoo

Update

$ composer update
// Require Composer's autoloader.
require 'vendor/autoload.php';

// Using Medoo namespace.
use Medoo\Medoo;

// Connect the database.
$database = new Medoo([
    'type' => 'mysql',
    'host' => 'localhost',
    'database' => 'name',
    'username' => 'your_username',
    'password' => 'your_password'
]);

$database->insert('account', [
    'user_name' => 'foo',
    'email' => 'foo@bar.com'
]);

$data = $database->select('account', [
    'user_name',
    'email'
], [
    'user_id' => 50
]);

echo json_encode($data);

// [{
//     "user_name" : "foo",
//     "email" : "foo@bar.com"
// }]
Medoo is an open-source project under the MIT license and will always be free to use. However, the project needs some funding every month to sustain itself. Any sponsorship for the project will be beneficial for us to build Medoo better for all PHP developers in the world, and we will put your company logo on the homepage as appreciation.