Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 2.42 KB

README.md

File metadata and controls

41 lines (32 loc) · 2.42 KB

Sqlcommenter-laravel

Sqlcommenter is a plugin/middleware/wrapper to augment SQL statements from laravel with comments that can be used later to correlate user code with SQL statements.

Installation

composer require "google/sqlcommenter-laravel"

Usage

Publish the config file from library to into laravel app using below command

php artisan vendor:publish --provider="Google\GoogleSqlCommenterLaravel\GoogleSqlCommenterServiceProvider"

Add the following class above Illuminate\Database\DatabaseServiceProvider::class, in config/app.php

'providers' => [
    ...
    Google\GoogleSqlCommenterLaravel\Database\DatabaseServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    ...
]

Options

With Laravel SqlCommenter, we have configuration to choose which tags to be appended to the comment. It is configurable in config/google_sqlcommenter.php

Field Included
by default?
Description
action
The application namespace of the matching URL pattern in your routes/api.php
controller
The name of the matching URL pattern as described in your routes/api.php
db_driver
The name of the php database engine
framework
The word "laravel" and the version of laravel being used
route
The route of the matching URL pattern as described in your routes/api.php
traceparent
The W3C TraceContext.Traceparent field of the OpenTelemetry trace