Download the PHP package solvrtech/symfony-logbook without Composer

On this page you can find all versions of the php package solvrtech/symfony-logbook. 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 symfony-logbook

symfony-logbook

symfony-logbook is a bundle that allows you to collect logs generated by your Symfony application and then submit them into LogBook. This bundle provides seamless integration with monolog-bundle and allows you to create and store log messages in a variety of different places while triggering various actions.

To install symfony-logbook, use the composer package manager by executing the following command in your terminal:

After the installation, register the symfony-logbook bundle in your application's config/bundles.php file by adding the following code:

In case you did not execute the recipe during the composer require command, you will need to manually create a new logbook configuration file at /config/packages/logbook.yaml with the following contents:

Make sure to replace the url value with the actual URL of your LogBook installation, and the key value with the API key that was generated for your app.

The instance_id value sets a unique identifier for your app’s deployment. This is useful when you have multiple instances or deployments (e.g. in horizontally-scaled environments). For example, you can set "app-1" for the first instance and "app-2" for the second one. The instance ID information will be shown as part of log details in LogBook.

Register the health status check route, it will be accessed by the logbook to check the health status of the application. To register it in your Symfony application, add the following configuration to your config/routes/logbook.yaml file:

Finally, configure the security for the health status check route in your Symfony application by adding the following configuration into your config/packages/security.yaml file:

Submitting logs into LogBook

The process of submitting logs to LogBook involves defining a logbook handler on the monolog configuration in your Symfony application. This can be done by adding the following configuration to your config/packages/monolog.yaml file ( see Writing Logs to different Locations):

By using the level config above, you can specify the minimum log level that will be submitted to your LogBook installation. The ordered log levels are (from low to high):

  1. DEBUG
  2. INFO
  3. NOTICE
  4. WARNING
  5. ERROR
  6. CRITICAL
  7. ALERT
  8. EMERGENCY

For example, when you set "level: warning", then only higher priority log levels such as WARNING, ERROR, CRITICAL, ALERT, and EMERGENCY are going to be submitted to your LogBook installation.

To submit log messages in your code, you can inject the default logger instance into your controller or service and then use it. For example:

For more information on how to use the LoggerInterface, you can refer to its documentation.

Submitting logs asynchronously

By default, logs will be submitted synchronously as soon as they are being recorded. and this might lead to a performance issue for your application. Fortunately, you can submit the logs asynchronously by queuing the logs (inside database or Redis) and then create a background task to submit the queue of logs in batch.

So first, you need to configure the logs transport config in your app’s config/packages/logbook.yaml file. Transport is registered using a DSN.

1.a Using Doctrine Transport

To use the Doctrine transport for asynchronous log handling, add the following configuration into your config/packages/logbook.yaml file:

In the example above:

1.b Using Redis Transport

To use the Redis transport for asynchronous log handling, add the following configuration to your config/packages/logbook.yaml file:

In the example above:

Choose the transport option that best suits your application's needs and configure it accordingly in the logbook.yaml file. Remember to adjust the batch size according to your needs.

After configuring the transport mechanism, you will need to submit the queue of logs in a background task by running php bin/console logbook:log:consume command periodically. You can do this by using Systemd or Supervisor.

2.a Using Systemd

Create a new service file for log consume service, for example /etc/systemd/system/log-consume.service, then add the following configurations into the file:

Start the service and enable it during system reboot:

2.b Using Supervisor

Create a new configuration file for the log consume service, for example /etc/supervisor/conf.d/log-consume.conf. Add the following configurations into the file:

To start the service, run the following commands:

Optional: set your application version

Application version is an optional parameter that can also be included inside log submission data into your LogBook installation. To do so, make sure to set the version in your Symfony app’s /config/service.yaml file:

It's worth noting that while it is recommended to set the application version, it is an optional step. When the "version" config is not found, log submission should work normally, but the version information will not be found in the submitted logs.


All versions of symfony-logbook with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-pdo Version *
ext-redis Version *
doctrine/dbal Version ^2.13|^3.0
doctrine/doctrine-bundle Version ^2.9
doctrine/orm Version ^2.11
ketut/random-string Version ^1.0
monolog/monolog Version ^2|^3
symfony/cache Version ~5.0|~6.0
symfony/config Version ~5.0|~6.0
symfony/console Version ~5.0|~6.0
symfony/dependency-injection Version ~5.0|~6.0
symfony/http-client Version ~5.0|~6.0
symfony/http-kernel Version ~5.0|~6.0
symfony/monolog-bridge Version ~5.0|~6.0
symfony/monolog-bundle Version ^3.8
symfony/process Version ~5.0|~6.0
symfony/security-bundle Version ~5.0|~6.0
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 solvrtech/symfony-logbook contains the following files

Loading the files please wait ....