Download the PHP package ucscode/squery without Composer
On this page you can find all versions of the php package ucscode/squery. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package squery
SQuery
SQL Syntax Generator for PHP
Introduction
Orignally made for User Synthetics, SQuery has progressed to the point of becoming an independent PHP library that simplifies the process of generating SQL syntax for your database queries. With sQuery, you can build SQL queries using an intuitive and fluent interface, reducing the need to write SQL directly. It supports various SQL operations like SELECT
, FROM
, JOIN
, WHERE
, GROUP BY
, and more.
The SQuery class provides a simplified and efficient way to interact with databases in PHP, specifically by easing the CRUD (Create, Read, Update, Delete) operations.
Features
- SQuery ensures the proper ordering of your SQL syntax, even if the methods are not called in order.
- SQuery supports nearly all functions related to SQL keywords.
- Build SQL queries in a structured and readable manner.
- Supports common SQL operations such as
SELECT
,FROM
,JOIN
,WHERE
,GROUP BY
,ORDER BY
, andLIMIT
. - Generate complex queries with ease by chaining methods.
- Designed to improve code maintainability and reduce the risk of SQL injection.
Requirements
- PHP 8.1 or higher.
- A compatible database (e.g., MySQL, MariaDB) and appropriate database extensions (e.g., MySQLi, PDO) to execute the generated queries.
Installation
SELECT SQL EXAMPLE
INSERT SQL EXAMPLE
UPDATE SQL EXAMPLE
DELETE SQL EXAMPLE
- To generate a DELETE query, use the
delete()
method:
USING JOIN STATEMENT
SQuery uses an instance of a Join
object to create and manage different types of join statements. For Example:
LEFT JOIN EXAMPLE
The same applies to other join statement like RIGHT JOIN
, INNER JOIN
etc
The Join
object literally accepts an SQuery
object as it's first parameter, making it capable of handling complex SQL
statement.
EXAMPLE
Warning!
It is important to note that the SQuery library does not automatically sanitize user input. When using the library, it is crucial to sanitize any user-supplied data before passing it as input to the SQuery methods.
Note
Please note that the SQuery
class only generates SQL query strings; it does not execute them against a database. To execute these queries, you would need to establish a database connection and use appropriate methods from the MySQLi or PDO libraries.
License
This project is licensed under the MIT License.