PHP code example of jove / medoo

1. Go to this page and download the library: Download jove/medoo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jove / medoo example snippets


// Require Composer's autoloader.
\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]",
    // }]
});