Download the PHP package spatie/laravel-sql-commenter without Composer

On this page you can find all versions of the php package spatie/laravel-sql-commenter. 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 laravel-sql-commenter

Add comments to SQL queries made by Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package can add comments to queries performed by Laravel. These comments will use the sqlcommenter format, which is understood by various tools and services, such as PlanetScale's Query Insights.

Here's what a query looks like by default:

Using this package, comments like this one will be added.

The comments allow you easily pinpoint the source of the query in your codebase.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

Optionally, you can publish the config file with:

This is the content of the published config file:

Usage

With the package installed, comments are automatically added. By publishing the config file, you can choose which things are added to the comments.

Adding arbitrary comments

If you want to add other arbitrary comments to the SqlComment, you can use the addComment method. The given comment will be added to the next performed query.

Dynamically enabling and disabling adding comments

You can dynamically enable and disable query logging.

Let's assume that you only want to add comments for a certain part in your code base. First, you would need to set the value of the enabled key in the sql-commenter config file to false. This will stop the package from adding comments to all queries. Right before the part where you want to add comments, call SqlCommenter::enable() and at the end call SqlCommenter::disable()

Adding you own commentator

If you want to add a comment to all performed queries, you can create your own Commentator class. It should implement the Spatie\SqlCommenter\Commenters\Commenter interface. The comments function should return a single or an array of Spatie\SqlCommenter\Comment.

Here's an example:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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


All versions of laravel-sql-commenter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^9.0|^10.0|^11.0
spatie/backtrace Version ^1.2
spatie/invade Version ^1.1|^2.0
spatie/laravel-package-tools Version ^1.12
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 spatie/laravel-sql-commenter contains the following files

Loading the files please wait ....