PHP code example of adecoder / eloquent

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

    

adecoder / eloquent example snippets


use Adecoder\Eloquent\Eloquent;

$query = "SELECT * FROM table_name WHERE id = :B_SEARCH;";
$param = array(':B_SEARCH' => 2);

$select = Eloquent::select(query: $query, param: $param, itself: false)->get();
dd($select);

use Adecoder\Eloquent\Eloquent;

$query = "INSERT INTO table_name (username, email_id) VALUE(:B_USER, :B_MAIL)";
$param = array(':B_USER' => 'md.aarmoni', ':B_MAIL' => '[email protected]');

$create = Eloquent::create(query: $query, param: $param, array: false)->get();
dd($create);

use Adecoder\Eloquent\Eloquent;

$query = "DELETE FROM table_name WHERE id = :B_DELETE;";
$param = array(':B_DELETE' => 14);

$delete = Eloquent::delete(query: $query, param: $param, array: false)->get();
dd($delete);

use Adecoder\Eloquent\Eloquent;

$query = "UPDATE table_name SET username = :B_USER, email_id = :B_MAIL WHERE id = :B_UPDATE;";
$param = array(':B_USER' => 'md-aarmoni', ':B_MAIL' => '[email protected]', ':B_UPDATE' => 14);
$update = Eloquent::update(query: $query, param: $param, array: false)->get();
dd($update);