This is a SQL library for the PHP.
It can help you better for write sql.
It can help you don't doing go to encapsulation Sql Code. let your sql developing extremely easy.
From the Command Line:
composer require gengbin/sqlbatis
In your composer.json
:
{
"require":{
"gengbin/sqlbatis": "^1.0"
}
}
1st, suggest you can to write encapsulation.
<?php
require 'vendor/autoload.php';
use \Gengbin\Sqlbatis\Sqlbatis;
use Gengbin\Sqlbatis\entity\ConnectSource;
class Main_Database extends Sqlbatis
{
function construct($connectData = '', $userName = '', $userPassword = ''): ConnectSource
{
$a = new ConnectSource();
$a->setConnectData('mysql:host=localhost;dbname=mysql');
$a->setUserName('root');
$a->setUserPassword('123456');
return $a;
}
}
2nd, you can to new This Object
<?php
$m = new Main_Database();
$result = $m->query('SELECT * FROM mm;');
$result = $m->exec('INSERT INTO v(a) VALUES("123123123")');
You can extend Sqlbathis and rewrite construct and return sql connect info in a array. Second you can call query, exec, resource. Learn More How to use
If you meet question, you can take issues, We can help you and feel happy.