PHP code example of neyltonbenjamim / database

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

    

neyltonbenjamim / database example snippets


define('DBS',array(

    'databasesv1' => array(
        'host'   => 'localhost',
        'user'   => 'root',
        'pass'   => '',
        'dbname' => 'databasesv1',
        'PREFIXTABLE' => 'tab'
    )
));

//Puxando autoload do composer
nco de dados
ord;
//Class user, para persistir user no banco de dados
class user extends Record
{
    const TABLENAME = 'tab_user';
    const PRIMARYKEY = 'user_id';
}
//Abrindo conexão com o banco de dados
Transaction::open();
//Puxando todos usuário do banco de dados
$users = user::all();

foreach ($users as $key => $user) {
	var_dump($user);
}