awesome9/database

An expressive WordPress SQL query builder.

1.0.6 2022-08-09 14:03 UTC

This package is auto-updated.

Last update: 2024-05-09 18:04:10 UTC


README

Awesome9 Latest Stable Version PHP from Packagist Total Downloads License

68747470733a2f2f696d672e69636f6e73382e636f6d2f6e6f6c616e2f3235362f64617461626173652e706e67

📃 About Database

This package is an expressive query builder for WordPress, it ease the SQL generation and takes care of sanitization of data as well.

Data Sanitisation

The purpose of this library is to provide an expressive and safe* way to run queries against your WordPress database (typically involving custom tables).

To this end all values provided are escaped, but note that column and table names are not yet escaped. In any case, even if they were you should be whitelisting any allowed columns/tables: otherwise using user-input, or other untrusted data to determine the column/table could allow an attacker to retrieve data they shouldn't or generate a map of your database.

💾 Installation

composer require awesome9/database

🕹 Usage

For complete usage details goto documentation

include('vendor/autoload.php');

$select = new Awesome9\Database\select( 'unique_query_id', 'users' );

$select->where( 'id', 2 )
  ->orderBy( 'id', 'desc' )
  ->limit( 20 )
  ->execute();

📖 Changelog

See the changelog file