php-sql-logger/README.md

24 lines
556 B
Markdown
Raw Permalink Normal View History

2018-05-02 10:35:38 +00:00
# Lumen 的sql记录组件
2018-05-02 09:56:08 +00:00
2018-05-02 11:30:51 +00:00
引入该组件后,如果 APP_DEBUG = true 时会自动将sql执行日志记录到 storage/logs/sql-{Y-m-d}.log 中。默认只保留最近15天的日志
2018-05-02 10:39:32 +00:00
2018-05-02 10:35:38 +00:00
### 引入
```bash
2019-01-23 08:15:25 +00:00
composer config repositories.php-sql-logger vcs git@git.int.haowumc.com:composer/php-sql-logger.git
2019-03-01 07:12:01 +00:00
composer require --dev paidian/php-sql-logger:dev-master
2018-05-02 10:35:38 +00:00
```
### 开启
2018-05-02 10:27:30 +00:00
```php
if (env('APP_ENV') == 'local') {
2018-05-17 13:01:34 +00:00
$app->register(Arch\SQLEventServiceProvider::class);
2018-05-02 10:27:30 +00:00
}
2018-05-02 10:35:38 +00:00
```
2018-05-02 10:27:30 +00:00
2018-05-02 10:35:38 +00:00
###配置
在.env中增加如下配置
```bash
APP_NAME = api
2018-05-02 10:27:30 +00:00
```
2018-05-02 10:35:38 +00:00