thatzokay/wpdb-builder
最新稳定版本:1.0.1
Composer 安装命令:
composer require thatzokay/wpdb-builder
包简介
Build database queries
README 文档
README
An easier way to create custom queries using WordPress' wpdb functions. The class is based on the excellent Pixie Query Builder.
Intended for plugin and theme developers craving sexier queries.
** Be aware. This class in early development stages. **
Install
First clone the repository.
git clone https://github.com/tormjens/wpdb-builder.git wpdb-builder
Run a composer install inside the repository to generate the autoload files
composer install
Start using the class. Its namespaced under WpdbBuilder
use \WpdbBuilder\Builder; var_dump(( Builder::table( 'posts' )->all() );
Example
A standard wpdb query looks something like:
$sql = $wpdb->prepare( "SELECT * FROM {$wpdb->posts} WHERE id = %s LIMIT 1", 1 ); $result = $wpdb->get_row( $sql );
With the wpdb Builder the same query with the same results looks like:
$result = Builder::table('posts')->where('id', 1)->first();
For more detailed documentation, please have a look at the Pixie Query Builder repository as most of the methods are availiable in this very class.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-06-04