Skip to content
forked from catfan/Medoo

The lightweight PHP database framework to accelerate the development. [Async version]

License

Notifications You must be signed in to change notification settings

LordDeveloper/Medoo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirement

PHP 8.0+ and installed PDO extension.

Get Started

Install via composer

Add Medoo to the composer.json configuration file.

$ composer require jove/medoo:dev-master

And update the composer

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

use Amp\Loop;
use function Medoo\connect;
use Medoo\Drivers\MySQL;

// Running the event loop
Loop::run(function () {
    // Connect the database.
    $database = connect(MySQL::class, [
        'host' => 'localhost',
        'database' => 'name',
        'username' => 'your_username',
        'password' => 'your_password'
    ]);
    
    // Enjoy
    yield $database->insert('account', [
        'user_name' => 'foo',
        'email' => '[email protected]'
    ]);
    
    $data = yield $database->select('account', [
        'user_name',
        'email'
    ], [
        'user_id' => 50
    ]);
    
    echo json_encode($data);

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

About

The lightweight PHP database framework to accelerate the development. [Async version]

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%