PHPackages                             catfan/medoo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. catfan/medoo

ActiveFramework[Database &amp; ORM](/categories/database)

catfan/medoo
============

The lightweight PHP database framework to accelerate development

v2.2.1(3mo ago)4.9k1.5M—4.1%1.1k[45 issues](https://github.com/catfan/Medoo/issues)[15 PRs](https://github.com/catfan/Medoo/pulls)20MITPHPPHP &gt;=7.3CI passing

Since Apr 28Pushed 3mo ago209 watchersCompare

[ Source](https://github.com/catfan/Medoo)[ Packagist](https://packagist.org/packages/catfan/medoo)[ Docs](https://medoo.in)[ Fund](https://paypal.me/AngelaonLai)[ Fund](https://opencollective.com/medoo)[ RSS](/packages/catfan-medoo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (60)Used By (20)Security (1)

 [![](https://cloud.githubusercontent.com/assets/1467904/19835326/ca62bc36-9ebd-11e6-8b37-7240d76319cd.png)](https://medoo.in)

 [![Build Status](https://github.com/catfan/Medoo/actions/workflows/php.yml/badge.svg)](https://github.com/catfan/Medoo/actions) [![Total Downloads](https://camo.githubusercontent.com/3dce6baaf3cb26a833cb74207d4e5d74fa0cf7616e32c5978cec6b2847c00ff9/68747470733a2f2f706f7365722e707567782e6f72672f63617466616e2f6d65646f6f2f646f776e6c6f616473)](https://packagist.org/packages/catfan/medoo) [![Latest Stable Version](https://camo.githubusercontent.com/291718728d8bb78ec36c6177f5c796f492adc9bd831bc0f4d003069236e2b6c9/68747470733a2f2f706f7365722e707567782e6f72672f63617466616e2f6d65646f6f2f762f737461626c65)](https://packagist.org/packages/catfan/medoo) [![License](https://camo.githubusercontent.com/b5dfa225aabc9f43efb0c3ffdf064f11f1ee28f736bc3d78ec30f7fd25f12408/68747470733a2f2f706f7365722e707567782e6f72672f63617466616e2f6d65646f6f2f6c6963656e7365)](https://packagist.org/packages/catfan/medoo) [![Backers on Open Collective](https://camo.githubusercontent.com/520d95988ba73be643291a4dc3425d0c437587bfa82ac39e242acce4bb256eb3/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f4d65646f6f2f6261636b6572732f62616467652e737667)](https://opencollective.com/medoo) [![Sponsors on Open Collective](https://camo.githubusercontent.com/688f309e2c48706b7a078f51b0ac45fba91680627ba78b16e3cf167c9746f928/68747470733a2f2f6f70656e636f6c6c6563746976652e636f6d2f4d65646f6f2f73706f6e736f72732f62616467652e737667) ](https://opencollective.com/medoo)

> The lightweight PHP database framework to accelerate development.

Features
--------

[](#features)

- **Lightweight** - Single-file framework with minimal dependencies.
- **Easy** - Simple and intuitive API for quick integration.
- **Powerful** - Supports complex SQL queries, data mapping, and SQL injection prevention.
- **Compatible** - Works with MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, Oracle, Sybase, and more.
- **Friendly** - Integrates seamlessly with Laravel, CodeIgniter, Yii, Slim, and other PHP frameworks.
- **Free** - Licensed under MIT, completely free to use for any purpose.

Requirements
------------

[](#requirements)

- PHP 7.3 or later
- PDO extension enabled

Get Started
-----------

[](#get-started)

### Install via composer

[](#install-via-composer)

Add Medoo to the `composer.json` configuration file.

```
$ composer require catfan/medoo
```

Then update Composer

```
$ composer update
```

```
// Require Composer's autoloader
require 'vendor/autoload.php';

// Import Medoo namespace
use Medoo\Medoo;

// Initialize 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' => 'foo@bar.com'
]);

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

echo json_encode($data);

// [{
//    "user_name" : "foo",
//    "email" : "foo@bar.com",
// }]
```

Contribution Guidelines
-----------------------

[](#contribution-guidelines)

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

### Testing &amp; Code Style

[](#testing--code-style)

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

### Commit Message Format

[](#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
-------

[](#license)

Medoo is released under the [MIT](https://opensource.org/licenses/MIT) License.

Links
-----

[](#links)

- Official website:
- Documentation:
- X.com:
- Open Collective:

\[More Products We Build\]
--------------------------

[](#more-products-we-build)

### Gear Browser - AI Extension Web Browser

[](#gear-browser---ai-extension-web-browser)

- [Website](https://gear4.app)
- [App Store](https://apps.apple.com/us/app/id1458962238)

[![Gear Browser](https://private-user-images.githubusercontent.com/1467904/544214529-9dfaf39e-8e79-4ef2-b2dd-f7af87a729c0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyNjg3NDYsIm5iZiI6MTc3NTI2ODQ0NiwicGF0aCI6Ii8xNDY3OTA0LzU0NDIxNDUyOS05ZGZhZjM5ZS04ZTc5LTRlZjItYjJkZC1mN2FmODdhNzI5YzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDRUMDIwNzI2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjIwYTZiNDUzZjczYTU2ZDM1YmY4ZGUzM2RjNDY0ZTAyYWQyYWRlODdkOGJkYjExMzEyZTUzMzFlODk1YzA0NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.fbbaW_Uu4XPYkHnIFnZ_3cdXVq8XfIcbOl0UNKNyvEI)](https://gear4.app)

###  Health Score

71

—

ExcellentBetter than 100% of packages

Maintenance80

Actively maintained with recent releases

Popularity71

Solid adoption and visibility

Community56

Growing community involvement

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 70.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Recently: every ~184 days

Total

58

Last Release

105d ago

Major Versions

v0.9.8 → v1.02015-10-05

v1.7.10 → v2.0.02021-04-28

PHP version history (3 changes)v0.9.5.3PHP &gt;=5.1

v1.2PHP &gt;=5.4

v2.0.0PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/669952c84bfcb305aea4be0c2d7592246b74c453b642712753011e1c2da71fde?d=identicon)[catfan](/maintainers/catfan)

---

Top Contributors

[![catfan](https://avatars.githubusercontent.com/u/1467904?v=4)](https://github.com/catfan "catfan (485 commits)")[![Angelaon](https://avatars.githubusercontent.com/u/13937887?v=4)](https://github.com/Angelaon "Angelaon (183 commits)")[![qatrix](https://avatars.githubusercontent.com/u/1537121?v=4)](https://github.com/qatrix "qatrix (5 commits)")[![IfnotFr](https://avatars.githubusercontent.com/u/1242308?v=4)](https://github.com/IfnotFr "IfnotFr (3 commits)")[![indiwine](https://avatars.githubusercontent.com/u/5175217?v=4)](https://github.com/indiwine "indiwine (2 commits)")[![utopiaio](https://avatars.githubusercontent.com/u/2365328?v=4)](https://github.com/utopiaio "utopiaio (2 commits)")[![shea-sollars](https://avatars.githubusercontent.com/u/2511672?v=4)](https://github.com/shea-sollars "shea-sollars (1 commits)")[![sobh](https://avatars.githubusercontent.com/u/3451740?v=4)](https://github.com/sobh "sobh (1 commits)")[![SyuTingSong](https://avatars.githubusercontent.com/u/680340?v=4)](https://github.com/SyuTingSong "SyuTingSong (1 commits)")[![tianyiw2013](https://avatars.githubusercontent.com/u/4644588?v=4)](https://github.com/tianyiw2013 "tianyiw2013 (1 commits)")[![jfcherng](https://avatars.githubusercontent.com/u/6594915?v=4)](https://github.com/jfcherng "jfcherng (1 commits)")[![etrappg](https://avatars.githubusercontent.com/u/17647359?v=4)](https://github.com/etrappg "etrappg (1 commits)")[![glenndavey83](https://avatars.githubusercontent.com/u/6992344?v=4)](https://github.com/glenndavey83 "glenndavey83 (1 commits)")[![jackled](https://avatars.githubusercontent.com/u/2091208?v=4)](https://github.com/jackled "jackled (1 commits)")[![amoydavid](https://avatars.githubusercontent.com/u/734190?v=4)](https://github.com/amoydavid "amoydavid (1 commits)")[![r0manchak](https://avatars.githubusercontent.com/u/4974042?v=4)](https://github.com/r0manchak "r0manchak (1 commits)")

---

Tags

composerdatabasehacktoberfestmedoomssqlmysqlphpphp-database-frameworkphp-frameworkphp-frameworkssqlitedatabasemysqlsqlitepostgresqlmariadbsqlmssqloraclelightweightphp frameworkdatabase library

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/catfan-medoo/health.svg)

```
[![Health](https://phpackages.com/badges/catfan-medoo/health.svg)](https://phpackages.com/packages/catfan-medoo)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

101.6k](/packages/ramadan-easy-model)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
