Download the PHP package ludal/mysql-querybuilder without Composer
On this page you can find all versions of the php package ludal/mysql-querybuilder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ludal/mysql-querybuilder
More information about ludal/mysql-querybuilder
Files in ludal/mysql-querybuilder
Package mysql-querybuilder
Short Description A simple PHP query builder for SQL queries
License MIT
Homepage https://github.com/iamludal/PHP-QueryBuilder
Informations about the package mysql-querybuilder
đ§ MySQL QueryBuilder
âšī¸ Presentation
This is a PHP query builder for simple MySQL queries. It allows you to write them without using strings nor heredoc, which often breaks the code's cleanliness.
This package is designed to support MySQL DBMS. However, it may work with other DBMS (PostgreSQL, SQLite...), but I cannot guarantee that, so use it at your own risk.
đĄ Made with â¤ī¸ in đĢđˇ
đ Usage
Getting Started
First, initialize a new instance of QueryBuilder
.
đĄ You can also pass a PDO instance as a parameter to execute and fetch queries directly.
From this instance, you can now build your query:
Then, you can either:
- Convert your query into a SQL string :
toSQL()
- Bind parameters:
setParam('name', 'John')
,setParams(['name' => 'John'])
... - Execute the query :
execute()
,execute(['John'])
... - Fetch the results of your query :
fetch()
,fetchAll()
,fetch(PDO::FETCH_COLUMN)
... - Get the rowCount :
rowCount()
- Get the PDO statement corresponding to your query :
getStatement()
- And more: see docs for a full reference
Supported Statements
- [x]
SELECT
- [x]
UPDATE
- [x]
DELETE FROM
- [x]
INSERT INTO
Supported Clauses
- [x]
WHERE
- [x]
GROUP BY
- [x]
ORDER BY
- [x]
LIMIT
- [x]
OFFSET
Code Samples
đ Docs
Wiki under construction. đ§
đ Acknowledgements
- Vincent Aranega for tips and tricks about the code organization