Download the PHP package web-chefs/db-lojack without Composer

On this page you can find all versions of the php package web-chefs/db-lojack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package db-lojack

DB-LoJack

Latest Version on Packagist Total Downloads

Laravel database query logger and debugger that support basic argument replacement.

Features

  1. Basic Query binding replacement
  2. Middleware and Listener handlers
  3. Security information hiding in production and staging environments
  4. Request query count logging
  5. Logs web and console queries
  6. DBLog facade for easy developer query debugging
  7. Configurable
  8. Default text logger support log file rotating without any dependencies on other packages

Versions

Confirmed to be working:

Install

Via Composer

Add Service Provider to config/app.php

Optionall add the DB LoJack Facade

Handlers

There are two handlers available each different pros and cons.

Middleware (Default)

Uses Laravel HTTP kernel middleware to enable database query logging and at the end of the request logs all queries as single block.

Pros

  1. Logs all queries as single block allowing you to trace queries to a specific request
  2. Logs query time in milliseconds for each query

Cons

  1. Does not work for console commands (See Event Listener)
  2. If large number of queries are executed in a request the tracking of the query data by Laravel can consume a large amount of memory, Middleware method should not be used for long running processes or requests
  3. If not the first middleware some queries can be missed, should be setup to be above any middleware that make database calls

Setup

Configure handler to middleware.

Add Middleware to App\Http\Kernel

Event Listener

Uses a Laravel Event listener database events. Regardless of configurations this method is used in console / artisan applications.

Pros

  1. Handles queries one at a time so is more memory efficient
  2. Logs all queries regardless of setup

Cons

  1. Does not log queries times consistently, often not provided by laravel
  2. Multiple queries for one request are logged as separately making it more difficult to trace back to a specific request

Setup

Configure handler to listener.

Developer Usage (Facade)

Logs

Query Logs

Query logs will log individual queries to a text file rotated daily.

EG: storage/logs/db/db_query.console.2018-06-06.log.

Performance Watchdog Logs

A PerformanceWatchdog class will collect statistics and queries and if a metric threshold is equaled or exceeded it will write a log.

Summary Log:

Records a single line per a request of the totals.

Detailed Log:

A log of each query run including with counters for each query and a mini stacktrace for each unique path to that query.

Configurations

To customize the configuration publish the config/db-lojack.php.

Default Config

Security & Information Leaking

It is generally a very bad idea to log full database queries in production with actual parameters / bindings as this will end up logging sensitive information like usernames, passwords and sessions ids to a generally low security location in the form of application logs.

For this reason if the Laravel environment is set to production or staging queries will be logged but without bindings being replace and queries will be left with ? placeholders.

Contributing

All code submissions will only be evaluated and accepted as pull-requests. If you have any questions or find any bugs please feel free to open an issue.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of db-lojack with dependencies

PHP Build Version
Package Version
Requires php Version ~5.6|~7.0
laravel/framework Version 5.*
symfony/stopwatch Version >=3.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package web-chefs/db-lojack contains the following files

Loading the files please wait ....