gengbin / sqlbatis
This is a tool help you better write sql
v1.1
2022-11-27 09:41 UTC
Requires
- ext-pdo: *
This package is auto-updated.
Last update: 2025-08-28 14:03:31 UTC
README
This is a SQL library for the PHP.
What does this project do?
It can help you better for write sql.
Why is this project useful?
It can help you don't doing go to encapsulation Sql Code. let your sql developing extremely easy.
Installation
Composer
From the Command Line:
composer require gengbin/sqlbatis
In your composer.json
:
{ "require":{ "gengbin/sqlbatis": "^1.0" } }
Basic Usage
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")');
How do I get started?
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
Where can I get more help, if I need it?
If you meet question, you can take issues, We can help you and feel happy.