Medoo is a free, open source databases project written in PHP and released under MIT. It has 4,950 GitHub stars, 1,128 forks and 50 open issues, and was last pushed 27 days ago. On this registry it ranks #148 of 203 tracked projects in Databases, with 5 head-to-head comparisons available.

What is Medoo?

Medoo is a lightweight, MIT-licensed PHP database framework, shipped as a single-file Composer package, that gives developers one clean API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, Oracle, Sybase and other engines over PDO — and it is built for PHP developers who want fast, readable database work without adopting a full ORM.

What it is

Medoo lives in the PHP ecosystem and installs through Composer as catfan/medoo. It requires PHP 7.3 or later with the PDO extension enabled, keeps dependencies to a minimum, and resolves its database work through a single file. A connection is one array passed to new Medoo([...]), holding type, host, database, username and password, and that same object then serves queries against whichever engine the type selects. It is designed to sit inside Laravel, CodeIgniter, Yii, Slim and other PHP frameworks rather than to replace them.

The concrete problem it solves is the plumbing that surrounds raw PDO: opening connections per engine, preparing statements by hand, and assembling SQL strings and condition clauses in application code. Medoo replaces that layer with method calls such as insert() and select() that take a table name, a column list and a condition array, while still being designed for complex SQL, data mapping and prepared statements without sacrificing readability. The README example shows insert('account', [...]) followed by select('account', ['user_name', 'email'], ['user_id' => 50]), with the result returned as an array that goes straight into json_encode.

Key capabilities

  • Single-file package with minimal dependencies, installed as catfan/medoo through Composer.
  • One API across MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, Oracle and Sybase, selected by the type key in the connection array.
  • insert() and select() style methods that accept table names, column lists and condition arrays, returning rows as arrays for json_encode.
  • Prepared statements and data mapping for complex SQL while keeping queries readable.
  • Runs on PHP 7.3 or later with the PDO extension enabled.
  • Fits naturally into Laravel, CodeIgniter, Yii, Slim and other PHP frameworks.
  • Documentation published at https://medoo.in in English, Arabic, German, Spanish, French, Hindi, Italian, Japanese, Korean, Portuguese, Russian, Thai, Ukrainian, Vietnamese, Simplified Chinese and Traditional Chinese.
  • MIT licence, free for personal and commercial projects.

Who uses it and how

  • PHP application teams working inside Laravel, CodeIgniter, Yii or Slim that want a query layer without pulling in a full ORM.
  • Projects that must talk to more than one engine across environments, since the same method calls work against MySQL, PostgreSQL, SQLite, MSSQL, Oracle and Sybase by changing connection configuration.
  • Small teams and solo developers who value a dependency-light, single-file package over a larger framework component.
  • Codebases on older or less common engines such as MSSQL, Oracle and Sybase, where uniform query methods reduce per-engine handling.
  • A widely adopted library, with roughly 4,950 stars and 1,128 forks on GitHub, so answers and prior art are broadly available.

Getting started

Install with composer require catfan/medoo, then run composer update, load vendor/autoload.php, import use Medoo\Medoo; and create the connection with new Medoo([...]). Contributors run phpunit tests for unit tests and php-cs-fixer fix for code style.

How it compares

No list of paid products this project replaces is provided, and no comparable database abstraction library is named in the facts, so Medoo stands alone in this registry on that axis. What the facts do establish is its positioning: MIT-licensed and free for commercial use, self-hosted inside the developer's own PHP application, with no hosted service and no vendor-held data.

When to use it — and when not to

Pick Medoo when a PHP project needs readable, engine-agnostic database access and the team is prepared to run its own database engine plus PHP 7.3 or later with PDO enabled; Medoo is a library, so it provisions no storage, no schema migrations and no server of its own. Skip it if the project expects a full ORM with models, relations and migration tooling, or if the team needs an extensive in-repository reference — the README is a short pointer to the external medoo.in documentation and a brief feature list, and the project carries 50 open issues, so evaluation should go through the official site rather than the registry page alone.

project readme (upstream, from github) — read inline

Build Status Total Downloads Latest Stable Version License Backers on Open Collective Sponsors on Open Collective

The lightweight PHP database framework to accelerate development.

Documentation

Features

  • Lightweight - A lightweight single-file package that keeps dependencies to a minimum.

  • Easy - A clean, intuitive API that helps you get started quickly.

  • Powerful - Designed for complex SQL, data mapping, and prepared statements without sacrificing readability.

  • Compatible - Works smoothly with MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, Oracle, Sybase, and more.

  • Friendly - Fits naturally into Laravel, CodeIgniter, Yii, Slim, and other PHP frameworks.

  • Free - Released under the MIT license and free to use in personal or commercial projects.

Requirements

  • PHP 7.3 or later
  • PDO extension enabled

Get Started

Install via composer

Add Medoo to the composer.json configuration file.

$ composer require catfan/medoo

Then update Composer

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

// Import the Medoo namespace.
use Medoo\Medoo;

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

// Insert data.
$database->insert('account', [
    'user_name' => 'foo',
    'email' => '[email protected]'
]);

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

echo json_encode($data);

// [{
//    "user_name" : "foo",
//    "email" : "[email protected]",
// }]

Contribution Guidelines

Before submitting a pull request, ensure compatibility with multiple database engines and include unit tests when possible.

Testing & Code Style

  • Run phpunit tests to execute unit tests.
  • Use php-cs-fixer fix to enforce code style consistency.

Commit Message Format

Each commit should begin with a tag indicating the type of change:

  • [fix] for bug fixes
  • [feature] for new features
  • [update] for improvements

Keep contributions simple and well-documented.

License

Medoo is released under the MIT License.

Links

[More Products We Build]

Gear Browser - AI Extension Web Browser

Gear Browser

Frequently asked questions

Is Medoo free to use?

Medoo is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does Medoo do?

The lightweight PHP database framework to accelerate the development.

What is Medoo written in?

Medoo is primarily written in PHP. Its source is publicly available at https://github.com/catfan/Medoo, and it has 4,950 GitHub stars.