This package provides a SQL query builder class built on top of WordPress core Database accessor. Usability is similar to Laravel's Eloquent.
The library also provides an abstract class and a trait to be used on data models built for custom tables.
This package is inspired by the WordPress MVC's Query Builder.
This package / library requires composer.
composer require ignitekit/wp-query-builder
Please read the wiki for documentation.
Quick snippet sample:
$books = wp_query_builder()
->select( 'ID' )
->select( 'post_name AS name' )
->from( 'posts' )
->where( ['post_type' => 'book'] )
->get();
foreach ( $books as $book ) {
echo $book->ID;
echo $book->name;
}
PSR-2 coding guidelines.
MIT License (c) 2019 10 Quality. MIT License (c) 2023 Darko G.