PHP code example of app2641 / sapphire-beans

1. Go to this page and download the library: Download app2641/sapphire-beans 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/ */

    

app2641 / sapphire-beans example snippets


define('DB_INI_FILE', '/path/to/database.ini');


use Sapphire\Database\Helper;

$db   = Helper::connection('develop');
$sql  = 'SELECT * FROM user WHERE user.name = ?';
$user = $db->build($sql, 'hoge')->fetch();


use Sapphire\Utility\Registry;

$db  = Registry::get('db');
$sql = 'UPDATE user SET name = ?, furigana = ?';
$db->build($sql, array('piyo', 'ぴよ'));