Skip to content

Latest commit

 

History

History

sqlcommenter-laravel

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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