PHP code example of webrium / foxql

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

    

webrium / foxql example snippets


use Foxdb\DB;

DB::addConnection([
    'driver'   => 'mysql',
    'host'     => '127.0.0.1',
    'database' => 'my_db',
    'username' => 'root',
    'password' => 'secret',
]);

// Query builder
$users = DB::table('users')->where('active', 1)->get();

// Eloquent ORM
use Foxdb\Eloquent\Model;

class User extends Model
{
    protected array $fillable = ['name', 'email'];
}

$user = User::create(['name' => 'Ali', 'email' => '[email protected]']);
$admins = User::where('role', 'admin')->get();