varobj / laravel-sqltrace
The Laravel Framework's sql trace
Installs: 41
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.2
- ext-redis: *
This package is auto-updated.
Last update: 2024-11-20 16:23:17 UTC
README
大量依赖数据库的业务,可以通过记录生命周期内所有 SQL 及其 SQL 执行位置,来调试代码。
版本要求
Laravel 版本 >= 6
PHP version >= 7.2
安装
composer require --dev varobj/laravel-sqltrace dev-master
使用
- 编辑项目的文件
app/Providers/EventServiceProvider.php
$listen
数组中添加下面一行
\Illuminate\Database\Events\QueryExecuted::class => [ \LaravelSQLTrace\SQLTraceEventListener::class, ],
- 变更文件不提交到服务器
git update-index --skip-worktree composer.json
git update-index --skip-worktree app/Providers/EventServiceProvider.php
- 变更文件和线上冲突时,撤回忽略
git update-index --no-skip-worktree composer.json
git update-index --no-skip-worktree app/Providers/EventServiceProvider.php