Example #1
0
<?php

include __DIR__ . '/../vendor/autoload.php';
$sql = 'SELECT a, b, c  FROM some_table WHERE d > 5';
$builder = new \BigShark\SQLToBuilder\BuilderClass($sql);
$result = $builder->convert();
echo $result;
//"DB::table('some_table')->select('a', 'b', 'c')->where('d', '>', 5)->get()"
<?php

if (file_exists(__DIR__ . '/../../../autoload.php')) {
    require_once __DIR__ . '/../../../autoload.php';
} else {
    require_once __DIR__ . '/../vendor/autoload.php';
}
if (!isset($_SERVER['argv'][1])) {
    throw new Exception('The argument is not specified or is incorrect');
}
$builder = new \BigShark\SQLToBuilder\BuilderClass($_SERVER['argv'][1]);
echo $builder->convert();