https://github.com/antonmarin/traceable-pdo
Adds trace to sql statement. Know the source of your queries!
https://github.com/antonmarin/traceable-pdo
debug pdo sql trace
Last synced: 5 months ago
JSON representation
Adds trace to sql statement. Know the source of your queries!
- Host: GitHub
- URL: https://github.com/antonmarin/traceable-pdo
- Owner: antonmarin
- License: mit
- Archived: true
- Created: 2017-01-17T11:35:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-05-28T20:00:32.000Z (about 5 years ago)
- Last Synced: 2025-05-02T06:46:51.371Z (about 1 year ago)
- Topics: debug, pdo, sql, trace
- Language: PHP
- Homepage:
- Size: 60.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# traceable-pdo
Adds trace to your sql statement
[](https://travis-ci.org/antonmarin/traceable-pdo)
[](https://packagist.org/packages/antonmarin/traceable-pdo)
[](https://packagist.org/packages/antonmarin/traceable-pdo)
[](https://codeclimate.com/github/antonmarin/traceable-pdo)
[](https://codeclimate.com/github/antonmarin/traceable-pdo/coverage)
[](https://packagist.org/packages/antonmarin/traceable-pdo)
## Usage
When you use `traceablePDO\PDO` your statement looks like
`SELECT 1 /* eJxT0NdSKM7PTVUoKUpMTlUoLinKzEtX0NIHAF05B60= */`
so to get trace you should just enter in your terminal
`php -r 'echo gzuncompress(base64_decode("eJxT0NdSKM7PTVUoKUpMTlUoLinKzEtX0NIHAF05B60="));'`
## Examples
### Yii2
config/main.php
```php
...
'db' => [
'class' => yii\db\Connection::class,
'dsn' => 'mysql:host=localhost;dbname=stay2',
'username' => 'root',
'password' => 'pass',
'charset' => 'utf8',
'pdoClass' => antonmarin\TraceablePDO\PDO::class, // this line adds traces
],
...
```