Download the PHP package scrnr/query-builder without Composer
On this page you can find all versions of the php package scrnr/query-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scrnr/query-builder
More information about scrnr/query-builder
Files in scrnr/query-builder
Package query-builder
Short Description QueryBuilder for MySQL driver
License MIT
Homepage https://github.com/scrnr/query-builder-library-php
Informations about the package query-builder
QueryBuilder for MySQL driver in PHP
For full documentation click here
Table of contents
- Description
- Features
- Installation
- How to use
- Example
- First
- Second
- Third
- Contribution
- Author
- License
Description :top:
The PHP Database Query Library is a powerful and easy-to-use PHP library that allows you to easily write queries to database and receive a string with the builded query. It provides a simple and intuitive interface for building complex SQL statements in your PHP code.
Features :top:
- Easy to use: The library provides a straightforward interface for building queries. You can easily create complex SQL statements without having to write raw SQL code.
- Secure: The library is designed with security in mind. It uses prepared statements to prevent SQL injection attacks.
- Flexible: The library supports a wide range of SQL operations such as SELECT, INSERT, UPDATE, DELETE.
- Object-oriented approach: The library follows an object-oriented approach to make it easier for developers to work with databases in PHP.
- Easy to integrate: The library is easy to integrate with existing PHP projects.
Installation :top:
You can install this library using Composer. Just add the following line to your composer.json
file:
Or you can use this command:
How to use :top:
To use the library, first, you need to create a new instance of the QueryBuilder
class:
Then, you can use the various methods provided by the class to build your query.
The QueryBuilder
class has four public methods:
select()
insert()
update()
delete()
Example :top:
The following example demonstrates how to use the QueryBuilder
class to build SQL statements.
First example :top:
Output
In this example, we call the select()
method with the table name and the all()
method to select all columns. Then, we call the getQuery()
method to get the SQL query.
Second example :top:
Output
In this example, we call the select()
method with the table name, the columns()
method to select specific columns, the from()
method with the second table name, and the alias()
method to specify the column and its alias, and the innerJoin()
method to join the categories table. Finally, we call the getQuery()
method to get the SQL query
Third example :top:
Output
In this example, we call the select()
method with the table name and the all()
method to select all columns. Then, we call the where()
method to start building the WHERE clause, the equal()
method to specify the condition, and the end()
method to end the WHERE clause. Next, we call the order()
method to order the results and the limit()
method to limit the number of results returned. Finally, we call the getAll()
method to get the SQL query and its prepared parameters as an array.
For more information about the getAll()
method click here.
Contribution :top:
Contributions to this library are welcome. You can report issues, suggest new features or submit pull requests on the GitHub repository.
Author :top:
:bust_in_silhouette: GitHub: scrnr
License :top:
This library is released under the MIT License. Please review the LICENSE file for more information
All versions of query-builder with dependencies
ext-pcre Version *