PHP code example of wtframework / sql

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

    

wtframework / sql example snippets


use WTFramework\SQL\SQL;

echo $stmt = SQL::select()
->from('users')
->where('email_address', '[email protected]');

print_r($stmt->bindings());

use WTFramework\SQL\Grammar;

$stmt1 = SQL::select();

SQL::use(Grammar::TSQL);

$stmt2 = SQL::select();

// $stmt1 will use MySQL, $stmt2 will use TSQL.

$stmt1->use(Grammar::PostgreSQL);

use WTFramework\SQL\SQL;

SQL::macro('count', function (string $table)
{

  return static::select()
  ->column('COUNT(*) AS counter')
  ->from($table);

});

SQL::count('users');