Download the PHP package bizkit/loggable-command-bundle without Composer

On this page you can find all versions of the php package bizkit/loggable-command-bundle. 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 loggable-command-bundle

BizkitLoggableCommandBundle

Build Status Latest Stable Version License Code Coverage

Symfony bundle which creates a dedicated Monolog log file for each command or message handler.

Features

Requirements

Installation

  1. Require the bundle with Composer:

  2. Create the bundle configuration file under config/packages/bizkit_loggable_command.yaml. Here is a reference configuration file:

  3. Enable the bundle in config/bundles.php by adding it to the array:

Usage

The bundle provides a way to log the output of a Symfony Command or Symfony Messenger's message handler into a dedicated file by dynamically creating a Monolog file handler & logger for each service. Supported file handlers are the stream & rotating_file handlers. To use other file handlers, a custom handler factory must be implemented & registered.

The output logger also uses a console handler to display the output inside a terminal. The stderr_threshold option can be used to set the log level at which the output is start being sent to the stderr stream instead of the stdout.

Other Monolog handlers can be added to the output logger as well as described in the dedicated section.

Command

The simplest way to enable output logging in a Symfony Command is by extending the LoggableCommand class. The output logger can be accessed through the $outputLogger property. By default, the name of the log file will be the snake cased version of the command name, e.g. app_my_loggable.

Instead of extending the LoggableCommand class, you can also use the LoggableOutputTrait with the LoggableOutputInterface. This is useful when you have a custom base command class.

Message handler

Output logging can also be used with Symfony Messenger's message handlers by implementing the LoggableOutputInterface. The name of the log file will be the snake cased version of the classname, e.g. my_message_handler. A custom name can be provided by implementing the NamedLoggableOutputInterface instead.

PHP 8 attribute

The default configuration can be overridden for each individual command or message handler by using the LoggableOutput PHP attribute. Among other things, it allows you to change which Monolog file handler is used by the output logger.

The PHP attribute can also be used as an alternative way to provide a custom name for the log file, in which case implementing the NamedLoggableOutputInterface is not necessary.

Attribute options are inherited from all parent classes that have the PHP attribute declared. In case both a parent & a child class have the same option defined, the one from the child class has precedence.

Doctrine annotations

If you're using a version of PHP prior to 8, Doctrine annotations can be used instead of PHP attributes as a way to override the default configuration.

  1. Require the Doctrine annotations library with Composer:

  2. Enable annotations support in the configuration:

The LoggableOutput PHP attribute also serves as the Doctrine annotation class.

Annotation options are also inherited from all parent classes.

Adding other Monolog handlers to the output logger

To add other Monolog handlers to the output logger, in case of an inclusive channel list, add the Monolog channel defined with the channel_name option to their channels list.

In case of an exclusive channel list, disable the auto-exclusion feature for that handler.

NOTE: In case of multiple output loggers, each output logger will use the same handler instance.

Monolog channel auto-exclusion

The Monolog channel used by the bundle is automatically excluded from all other Monolog handlers with an exclusive channel list. There's no need to manually add the channel to the list.

Disabling auto-exclusion

If you don't want the channel to be automatically excluded from a certain handler, add it to the channels list prefixed with !!.

Handler factories

Handler factories are used to instantiate & configure the file handler used by the output logger.

Custom handler factories

To implement a custom handler factory all you need to do is create a service which implements the HandlerFactoryInterface interface.

Use the FQCN of the service in the configuration:

If you are not using Symfony's autoconfigure feature or wish to use an alias in the configuration, tag the service with the bizkit_loggable_command.handler_factory tag.

To simplify the configuring of a handler factory the bundle comes with an AbstractHandlerFactory class which can be used to configure some common handler features such as the PSR 3 log message processor or a log formatter.

Versioning

This project adheres to Semantic Versioning 2.0.0.

Reporting issues

Use the issue tracker to report any issues you might have.

License

See the LICENSE file for license rights and limitations (MIT).


All versions of loggable-command-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
monolog/monolog Version ^1.25.1 || ^2 || ^3
symfony/config Version ^4.4 || ^5.2 || ^6.0 || ^7.0
symfony/console Version ^4.4 || ^5.2 || ^6.0 || ^7.0
symfony/dependency-injection Version ^4.4 || ^5.2 || ^6.0 || ^7.0
symfony/http-kernel Version ^4.4 || ^5.2 || ^6.0 || ^7.0
symfony/monolog-bridge Version ^4.4 || ^5.2 || ^6.0 || ^7.0
symfony/monolog-bundle 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 bizkit/loggable-command-bundle contains the following files

Loading the files please wait ....