guagualai/query-builder-helper
最新稳定版本:v1.0.0
Composer 安装命令:
composer require guagualai/query-builder-helper
包简介
組出 SQL 語法以及把參數帶上去
README 文档
README
QueryBuilderHelper is a PHP package designed to work with Laravel's Eloquent query builder. It provides a convenient way to get the raw SQL query along with its bindings, which can be useful for debugging and logging.
Installation
You can install the package via composer:
composer require guagualai/query-builder-helper
Usage
Here's a simple example of how to use QueryBuilderHelper:
use Guagualai\QueryBuilderHelper\SqlHelper; use Illuminate\Database\Eloquent\Model; class YourModel extends Model { // Your model's methods... } $query = YourModel::where('column', 'value')->getQuery(); $sqlWithBindings = SqlHelper::getWithBindings($query); echo $sqlWithBindings;
This will output the raw SQL query with the bindings included, making it easier to see the actual query that will be run against the database.
Example Output
When you use the QueryBuilderHelper, you might see output similar to the following:
// Example Eloquent query $query = YourModel::where('name', 'John')->where('age', '>', 25)->getQuery(); $sqlWithBindings = SqlHelper::getWithBindings($query); echo $sqlWithBindings;
The output will be:
select * from `your_models` where `name` = 'John' and `age` > 25
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-14