{"id":41451868,"url":"https://github.com/mitoop/laravel-query-logger","last_synced_at":"2026-01-23T15:28:28.648Z","repository":{"id":143417931,"uuid":"615617343","full_name":"mitoop/laravel-query-logger","owner":"mitoop","description":"There might be a problem if you don't see sql.","archived":false,"fork":false,"pushed_at":"2025-07-20T07:17:27.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-27T15:07:39.971Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mitoop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-18T06:55:52.000Z","updated_at":"2025-07-20T07:17:16.000Z","dependencies_parsed_at":"2024-01-09T07:24:49.882Z","dependency_job_id":"230141fb-ee67-4f17-a77d-51b63d020d18","html_url":"https://github.com/mitoop/laravel-query-logger","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/mitoop/laravel-query-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitoop%2Flaravel-query-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitoop%2Flaravel-query-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitoop%2Flaravel-query-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitoop%2Flaravel-query-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitoop","download_url":"https://codeload.github.com/mitoop/laravel-query-logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitoop%2Flaravel-query-logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28694522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T14:15:13.573Z","status":"ssl_error","status_checked_at":"2026-01-23T14:09:05.534Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T15:28:26.821Z","updated_at":"2026-01-23T15:28:28.627Z","avatar_url":"https://github.com/mitoop.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eLaravel Query Logger\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e🔮 轻松记录 SQL 执行日志，助力调试与分析\u003c/p\u003e\n\n\n## 安装\n```shell\ncomposer require mitoop/laravel-query-logger\n```\n\n## 配置\n在 config/logging.php 中添加日志频道配置：\n```php\n\u003c?php\n\nreturn [\n    'channels' =\u003e [\n        // 其他日志频道配置...\n        'sql' =\u003e [\n            'driver' =\u003e 'daily',\n            'path' =\u003e storage_path('logs/sql.log'),\n            'level' =\u003e env('LOG_LEVEL', 'debug'),\n            'permission' =\u003e 0664,\n        ],\n    ],\n\n    // 查询日志相关配置\n    'query' =\u003e [\n        'enabled' =\u003e env('ENABLE_QUERY_LOG', false), // 总开关，是否启用 SQL 查询日志\n        'channel' =\u003e 'sql', // 日志记录频道\n        'excluded_tables' =\u003e ['telescope_'], // 排除表名，支持前缀匹配\n    ],\n];\n```\n## 使用\n#### 默认行为\n当 `query.enabled` 设置为 `true` 时，包会自动记录所有的 SQL 查询日志，无需额外配置。\n\n#### 自定义触发条件\n如果你想根据自定义条件控制 SQL 日志的记录，可以在 `AppServiceProvider` 的 `boot()` 方法中，调用 `QueryDebugger::enableWhen()` 设置触发条件。\n\n日志仅在 **总开关开启** 且 **自定义条件为真** 时，才会被记录。\n\n```php\n\u003c?php\nuse Mitoop\\LaravelQueryLogger\\SqlDebug;\n\npublic function boot()\n{\n    QueryDebugger::enableWhen(function () {\n        return is_local() || is_dev() || request()-\u003ehasCookie('debug_sql');\n    });\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitoop%2Flaravel-query-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitoop%2Flaravel-query-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitoop%2Flaravel-query-logger/lists"}