laravel-dump-sql maintained by guanguans
Last update
2026/03/27 08:49
License
Require
- php >=7.3
- symfony/var-dumper ^5.4 || ^6.0 || ^7.0
- illuminate/console ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/database ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/http ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/log ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/support ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
Last update
2026/03/26 22:05
License
Require
- php >=7.3
- illuminate/console ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/database ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/http ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/log ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/support ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- symfony/var-dumper ^5.4 || ^6.0 || ^7.0
Last update
2026/03/26 22:05
License
Require
- php >=7.3
- illuminate/console ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/database ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/http ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/log ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/support ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- symfony/var-dumper ^5.4 || ^6.0 || ^7.0
Last update
2024/03/14 07:39
License
Require
- php >=7.3
- illuminate/console ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/database ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/http ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/log ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/support ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
- symfony/var-dumper ^5.4 || ^6.0 || ^7.0
Last update
2024/03/13 11:29
License
Require
- php >=7.3
- illuminate/console ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/database ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/http ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/log ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/support ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- symfony/var-dumper ^5.4 || ^6.0 || ^7.0
Last update
2023/03/25 14:19
License
Require
- php >=7.2
- illuminate/console ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/database ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/http ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/log ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- illuminate/support ^6.10 || ^7.0 || ^8.0 || ^9.0 || ^10.0
- symfony/var-dumper ^4.3 || ^5.0 || ^6.0
Last update
2023/01/24 22:14
License
Require
- php >=7.2
- illuminate/console ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/database ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/http ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/log ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/support ^6.10 || ^7.0 || ^8.0 || ^9.0
- symfony/var-dumper ^4.3 || ^5.0 || ^6.0
Last update
2022/07/06 10:29
License
Require
- php >=7.2
- illuminate/console ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/database ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/http ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/log ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/support ^6.10 || ^7.0 || ^8.0 || ^9.0
- symfony/var-dumper ^4.3 || ^5.0 || ^6.0
Last update
2022/04/01 09:33
License
Require
- php >=7.2
- illuminate/console ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/database ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/http ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/log ^6.10 || ^7.0 || ^8.0 || ^9.0
- illuminate/support ^6.10 || ^7.0 || ^8.0 || ^9.0
- symfony/var-dumper ^4.3 || ^5.0 || ^6.0
Last update
2022/02/14 10:59
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- symfony/var-dumper ^4.1 || ^5.0 || ^6.0
Last update
2021/11/05 08:43
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/04 11:04
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/04 10:17
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/04 08:36
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/04 03:59
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/04 03:01
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/03 11:22
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/03 09:15
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/03 09:06
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/03 08:03
License
Require
- php >=7.2
- illuminate/console ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/database ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.6 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.6 || ^6.0 || ^7.0 || ^8.0
- symfony/var-dumper ^4.1 || ^5.0
Last update
2021/11/03 07:19
License
Require
- php >=7.1
- illuminate/database ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.5 || ^6.0 || ^7.0 || ^8.0
Last update
2021/11/03 07:19
License
Require
- php >=7.1
- illuminate/database ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.5 || ^6.0 || ^7.0 || ^8.0
Last update
2021/11/02 11:08
License
Require
- php >=7.1
- illuminate/database ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/http ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/log ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.5 || ^6.0 || ^7.0 || ^8.0
Last update
2021/10/26 12:11
License
Require
- php >=7.1
- illuminate/database ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.5 || ^6.0 || ^7.0 || ^8.0
- doctrine/sql-formatter ^1.1
Last update
2021/10/17 12:03
License
Require
- php >=7.1
- illuminate/database ^5.1 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.1 || ^6.0 || ^7.0 || ^8.0
- doctrine/sql-formatter ^1.1
Last update
2021/10/16 11:07
License
Require
- php >=7.1
- illuminate/database ^5.1 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.1 || ^6.0 || ^7.0 || ^8.0
- doctrine/sql-formatter ^1.1
Last update
2021/09/30 05:48
License
Require
- php >=7.1
- illuminate/database ^5.1 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.1 || ^6.0 || ^7.0 || ^8.0
- doctrine/sql-formatter ^1.1
Last update
2021/09/29 10:26
License
Require
- illuminate/database ^5.1 || ^6.0 || ^7.0 || ^8.0
- illuminate/support ^5.1 || ^6.0 || ^7.0 || ^8.0
- doctrine/sql-formatter ^1.1
Last update
2021/09/29 08:16
License
Require
- laravel/framework ^5.1 || ^6.0 || ^7.0 || ^8.0
- doctrine/sql-formatter ^1.1
laravel-dump-sql

Assist laravel application to obtain complete sql statement. - 辅助 laravel 应用获取完整的 sql 语句。
The sql statement obtained by the query construction method in laravel is not bound to the conditional parameters, similar to
select * from users where id= ?. This expansion pack can help you get a complete sql statement. - laravel 中查询构造方法得到的 sql 语句没有绑定条件参数,类似于select * from users where id= ?。这个扩展包可辅助你获取完整的 sql 语句。
功能
- 添加获取 sql 语句的查询构建便捷方法(
toRawSql、dumpSql、ddSql、logListenedSql、dumpListenedSql、ddListenedSql) - 添加监控 sql 语句的服务命令
环境要求
- laravel || lumen >= 6.10
安装
$ composer require guanguans/laravel-dump-sql -v
lumen 中配置(laravel 中请忽略)
将下面代码添加到 bootstrap/app.php 文件中的 Register Service Providers 部分
$app->register(\Guanguans\LaravelDumpSql\ServiceProvider::class);
使用
监控 sql 语句的服务的使用
$ php artisan server:dump-sql

获取 sql 语句的查询构建便捷方法的使用
安装配置完毕后数据库查询构造方法会新增以下几个方法:
- toRawSql() - 获取完整的 sql
- dumpSql() - 打印完整的 sql
- ddSql() - 打印完整的 sql 并且退出
- logListenedSql() - 记录被监听到的 sql
- dumpListenedSql() - 打印被监听到的 sql
- ddListenedSql() - 打印被监听到的 sql 并且退出
toRawSql() - 获取完整的 sql
$sql = User::query()->where('id', 1)->toRawSql();
dd($sql);
"select * from `xb_users` where `id` = 1"
dumpSql() - 打印完整的 sql
User::query()->where('id', 1)->dumpSql();
User::query()->where('id', 2)->dumpSql();
"select * from `xb_users` where `id` = 1"
"select * from `xb_users` where `id` = 2"
ddSql() - 打印完整的 sql 并且退出
User::query()->where('id', 1)->ddSql();
User::query()->where('id', 2)->ddSql();
"select * from `xb_users` where `id` = 1"
logListenedSql() - 记录被监听到的 sql
User::query()->where('id', 1)->logListenedSql()->first();
User::query()->where('id', 2)->first();
# 日志中
[Laravel] [39.97ms] select * from `xb_users` where `id` = '1' limit 1 | GET: /
[Laravel] [39.93ms] select * from `xb_users` where `id` = '2' limit 1 | GET: /
dumpListenedSql() - 打印被监听到的 sql
User::query()->where('id', 1)->dumpListenedSql()->first();
User::query()->where('id', 2)->first();
[Laravel] [39.97ms] select * from `xb_users` where `id` = '1' limit 1 | GET: /
[Laravel] [39.93ms] select * from `xb_users` where `id` = '2' limit 1 | GET: /
ddListenedSql() - 打印被监听到的 sql 并且退出
User::query()->where('id', 1)->ddListenedSql()->first();
User::query()->where('id', 2)->first();
[Laravel] [39.97ms] select * from `xb_users` where `id` = '1' limit 1 | GET: /
安全漏洞
请查看我们的安全政策了解如何报告安全漏洞。
贡献者
协议
MIT 许可证(MIT)。有关更多信息,请参见协议文件。