Download the PHP package itspire/monolog-loki without Composer

On this page you can find all versions of the php package itspire/monolog-loki. 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 monolog-loki

Itspire - Monolog Loki

This library follows the PSR-12 convention.

Usage

Recommended Usage

Since Loki log handling uses a remote server, logging is prone to be subject of timeout, network shortage and so on. To avoid your application being broken in such a case, we recommend wrapping the handler in a WhatFailureGroupHandler

Native

Non-customizable curl options

The following options are not customizable in the configuration:

Symfony App

Configure LokiHandler Service

Note : We're currently working on a possible bundle based implementation for Symfony but at the moment, this is the way.

Configure Monolog to use Loki Handler

Laravel App

Add Loki to config/logging.php

Set env vars

These vars can be injected by Kubernetes, Docker or simply by setting them on the .env file

Laravel with WhatFailureGroupHandler

Since Loki log handling uses a remote server, logging is prone to be subject of timeout, network shortage and so on. To avoid your application being broken in such a case, we recommend wrapping the handler in a WhatFailureGroupHandler.

Create a custom Log handler and wrap the LokiHandler with a WhatFailureGroupHandler.

Update the config accordingly:

Testing

In order to test using the provided docker-compose file, you'll need an up-to-date docker/docker-compose installation You can start the Loki container by navigating to src/main/test/docker and running

If you're testing from a local php installation, you'll need to retrieve the Loki container ip with :

and replace the ip in the LOKI_ENTRYPOINT definition in phpunit.xml :

If you're testing from containerized php not in the default docker bridge network,
you'll need to start the container with an extra host named Loki mapped to your current host ip,
using the following option :

Run the test using phpunit and you can verify that posting to Loki works by running the following from your host terminal :

For each time you ran the tests, you should see a log entry looking like the following :


All versions of monolog-loki with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1
monolog/monolog Version ~3.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 itspire/monolog-loki contains the following files

Loading the files please wait ....