1. Go to this page and download the library: Download furkifor/sql_dumper 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/ */
furkifor / sql_dumper example snippets
$sql_dumper = new Furkifor\SqlDumper("users");
// Simple query
echo $sql_dumper->select('*')->get();
// SELECT * FROM users
// Query with conditions
echo $sql_dumper->select('name, email')
->where('age > ?', [18])
->orderBy('name', 'DESC')
->limit(10)
->get();
// SELECT name, email FROM users WHERE age > ? ORDER BY name DESC LIMIT 10
// JOIN operations
echo $sql_dumper->select('users.*, roles.name as role_name')
->join('INNER', 'roles', 'users.role_id = roles.id')
->where('users.active = ?', [1])
->get();
// SELECT users.*, roles.name as role_name FROM users
// INNER JOIN roles ON users.role_id = roles.id WHERE users.active = ?
// Grouping and HAVING
echo $sql_dumper->select('country, COUNT(*) as user_count')
->groupBy('country')
->having('user_count > 100')
->get();
// SELECT country, COUNT(*) as user_count FROM users
// GROUP BY country HAVING user_count > 100