Getting Started with Medoo: A Lightweight PHP Database Framework
Setting Up Medoo
After installation, you can initialize Medoo by including the autoload file and setting up the database connection as shown below:
<?php
require 'vendor/autoload.php';
use Medoo\Medoo;
// Initialize
$database = new Medoo([
'type' => 'mysql',
'host' => 'localhost',
'database' => 'my_database',
'username' => 'my_username',
'password' => 'my_password'
]);
// Now you can start interacting with your database
?>
Using Medoo: A Simple Query Example
Let's perform a simple query to retrieve data from a table:
$data = $database->select("my_table", "*", [
"user_id" => 123
]);
print_r($data);