Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

Medoo

The lightest PHP database framework to accelerate development

Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star half bd79095782ee4930099175e5ce7f4c89fa3ddabcd56fffcc7c74f6f2a2d46b27 (6 ratings)
Rated 4.58 out of 5
Subscribe to updates I use Medoo


Statistics on Medoo

Number of watchers on Github 3070
Number of open issues 159
Average time to close an issue 16 days
Main language PHP
Average time to merge a PR 22 days
Open pull requests 74+
Closed pull requests 73+
Last commit over 1 year ago
Repo Created over 6 years ago
Repo Last Updated over 1 year ago
Size 299 KB
Homepage https://medoo.in
Organization / Authorcatfan
Latest Releasev1.5.5
Contributors11
Page Updated
Do you use Medoo? Leave a review!
View open issues (159)
View Medoo activity
View on github
Fresh, new opensource launches ๐Ÿš€๐Ÿš€๐Ÿš€
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating Medoo for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)
What people are saying about Medoo Leave a review
Secure, easy to use, many feautures, and results in beautifull code
Database insertions made easy and secure

Total Downloads Latest Stable Version License

The Lightest PHP database framework to accelerate development

Features

  • Lightweight - Less than 100 KB, portable 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, PostgreSQL, Sybase, Oracle and more

  • Friendly - Works well with every PHP frameworks, like Laravel, Codeigniter, Yii, Slim, and framework which supports singleton extension or composer

  • Free - Under MIT license, you can use it anywhere whatever you want

Requirement

PHP 5.4+ and PDO extension installed

Get Started

Install via composer

Add Medoo to composer.json configuration file.

$ composer require catfan/Medoo

And update the composer

$ composer update
// If you installed via composer, just use this code to requrie autoloader on the top of your projects.
require 'vendor/autoload.php';

// Using Medoo namespace
use Medoo\Medoo;

// Initialize
$database = new Medoo([
    'database_type' => 'mysql',
    'database_name' => 'name',
    'server' => 'localhost',
    'username' => 'your_username',
    'password' => 'your_password'
]);

// Enjoy
$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",
//     }
// ]

Contribution Guides

For most of time, Medoo is using develop branch for adding feature and fixing bug, and the branch will be merged into master branch while releasing a public version. For contribution, submit your code to the develop branch, and start a pull request into it.

On develop branch, each commits are started with [fix], [feature] or [update] tag to indicate the change.

Keep it simple and keep it clear.

License

Medoo is under the MIT license.

Links

Medoo open issues Ask a question     (View All Issues)
  • almost 3 years Table prefix with * will not work on select column name
  • almost 3 years Space in Column Name
  • almost 3 years Search by distance
  • almost 3 years OCI8 lastInsertId error
  • about 3 years Use ACOS/SIN/COS functions with Medoo
  • about 3 years Modify where_clause ($ where) method
  • about 3 years Azure DB
  • about 3 years Select function should return var typed on database types
  • about 3 years [BUG] execute insert method return wrong errorInfo
  • about 3 years Feature request: global error logging
  • about 3 years SQL functions should be case insensitive
  • about 3 years Join operations on Mysql reserved keywords such as "status", "key"
  • about 3 years Data updating bug?
  • about 3 years WHO NEED RANDOM (I ADD THIS FUNCTION)
  • about 3 years Notice: Undefined index: COUNT (NOW I FIXED)
  • about 3 years compare columns
  • about 3 years columns in select result set is in different order on different environment
  • about 3 years medoo where use of external conditions
  • about 3 years insert columns are not quoted
  • about 3 years On Linux Add pdo_sqlsrv support
  • about 3 years support json_decode on select
  • about 3 years Mapping tables with same column names does not work
  • over 3 years REPLACE INTO support
  • over 3 years BUG
  • over 3 years like putting AND in mysql query
  • over 3 years [Issue] count(*)(count) aliasing count(*) not working
  • over 3 years Fetch All Result output problem
  • over 3 years [FIX] MSSQL Driver with $database->info();
  • over 3 years NOW() function
  • over 3 years function column_quote Have bug
Medoo open pull requests (View All Pulls)
  • fix typo in has()
  • Update medoo.php
  • Update medoo.php
  • Permit functions in WHERE clause
  • [update] add multi-columns GROUP BY support.
  • add another callback function at [ action ]
  • [feature] Add method fetch_class to make the next select return obj
  • Added isAlive() function
  • [fix] Missing break at case 'mariadb' in __construct()
  • [feature] Add - Comment, compile_bind(), statement method (query + exec)
  • fix fn_quote() preg_match is not case insensitive
  • bugfix join missing prefix
  • LIMIT Array parsing changed, no error now with Single Array
  • [update] Added "exit_on_errors" Initialization option
  • Added support for special columns "COUNT", "MAX" etc in "columns" array
  • Added namespace support
  • [feature] headers/column names as array
  • perfix for join table
  • Typo in the word Linux
  • Fix issue #275
  • Enable table alias
  • [update] Remove Closing tag from end of the file
  • Enable function in columns
  • fix not use sql function
  • [update] Error Function
  • fix get bug
  • Add distinct() method
  • Support database agnostic connections
  • [feature][update] Adding method dump_log() which dumps the medoo logs to external dump file.
  • [feature] Support aggregate functions in select
  • [feature] Add ignore parameters for insert()
  • support use tablename.* to select all column
  • [feature] Added support for INSERT keywords #329
  • Fixed cross database query error
  • [feature] option fetch_style
  • Fixed join query error when the table have a prefix
  • Fixed CDQ Error
  • [feature] Automatic table prefixing in fully-qualified column names
  • [feature] Enable table alias
  • ไฟฎๅคไฝฟ็”จ่กจๅ‰็ผ€ๆ—ถ๏ผŒๅคš่กจๆŸฅ่ฏข่กจๅไธๆญฃ็กฎ็š„BUG
  • Set app name in MSSQL Connection string
  • Add REGEX in WHERE query
  • [FIX] insert return false on failure
  • [fix] Return last id after insert when you're using pgsql driver (Issue: #386)
  • Multi-table insert affairs issues
  • [fix] add logs_max_count and new func append_log
  • [feature] Add colon `:` as a possible symbol at the filed name
  • Add the medoo console
  • Added namespace and 1 extra (optional) argument
  • add parenthesis in where clause
  • Make medoo work with schema
  • Fix namespaces for PDO, PDOException and Exception
  • Feature column star
  • BUGFIX: #517, get(), return empty array
  • Increase the abnormal disconnect automatically reconnected
  • [feature] Array support of LIKE with AND condition
  • [feature] Adds a method for clearing logs
  • [feature] Implementing Result class in order to facilitate the develoโ€ฆ
  • fix postgres insert expression boolean value
  • [fix] #481 Check for empty OR/AND arrays in WHERE
  • CHANGE: #529, add method isTable
  • [fix] issue #436
  • Update medoo.php
  • Allow Join to compare string values.
  • Check socket and server options simultaneous use
  • transation by the other way
  • Escape special characters with `like`
  • Update Medoo.php
  • Postgres boolean fix.
  • [feature] joining across ditterent databases
  • Adding array typing to parameters of methods that are array type.
  • implement interface
  • fix Connect two column with condition sign [!=] as one of array value
  • [feat] select columns use raw
Medoo questions on Stackoverflow (View All Questions)
  • Medoo WHERE clause multiple conditions
  • can help me on how to import excel to php mysql using Medoo framework
  • How to escape default behaviour of Medoo table prefixing in Select query with joining
  • Medoo - how make a WHERE condition with compare two fields
  • Medoo PHP db framework - select join
  • medoo select term doesn't work correct
  • SQL query via Medoo taking too long to finish
  • Sanitising user input with Medoo
  • Medoo PHP Framework and joining multiple tables
  • Am I handling query errors correctly in Medoo Framework?
  • Medoo - Select issue
  • Need to "Select Count(*)" inside of a Select using Medoo
  • PHP Medoo - num rows
  • Medoo php sql - change search term
  • Medoo - Updating table row matching multiple field
  • Medoo PHP framework - 'select' 'left join' using 'and' to test against a condition (as in col = val)
  • Medoo delete ID found in array
  • Medoo SQL database select rows matching a date range
  • Php Medoo update vs replace
  • Medoo PHP Framework Using AND
  • Medoo PHP db framework - Call to a member function fetchColumn()
  • Medoo, short ajax syntax
  • Medoo insert issue causing internal server error
  • Use "Alias" in "Select" With Medoo
  • get the last auto incremented id with medoo
  • Medoo - Updating table row matching field
Medoo list of languages used
Medoo latest release notes
v1.5.5 Medoo v1.5.5

We fixed the customize DSN bug and update the year date.

v1.5.4 Medoo v1.5.4

Fix error map key while output IN data

v1.5.3 Medoo v1.5.3

We fixed some bug on Xmas.

Other projects in PHP