v3.3 2019-08-06 06:42 UTC

This package is auto-updated.

Last update: 2022-08-06 13:42:09 UTC


PhpLogger - logging system, which is designed to help you get insights from your application data. It includes logs collection, process tracking and pivot table event exploration. We encourage you to log everything your application does and we provide the tools for that.

CircleCI MIT Licence


You need an account first, which can be created at

The basic installation requires composer to be installed on the system.

composer require phplogger/phplogger

Initialize $logger

You need to create PHP Logger object

# add autoloader
include __DIR__ . '/vendor/autoload.php';
# create logger object
$token = 'd173f174f8aa6793ab8f8b6c9286ec9834a33ee6';
$logger = new \PhpLogger\Logger($token);

Phplogger client supports PSR-3 standard.

NOTE: token can be acquired at the PHP Logger first setup tutorial.

Collect logs

Call methods with appropriate severity. All of the severity methods support $message and $context arguments.

# write log messages
$logger->emergency('this is an emergency message line');
$logger->alert('this is an alert message line');
$logger->critical('this is a critical message line');
$logger->error('this is an error message line');
$logger->warning('this is a warning message line');
$logger->notice('this is a notice message line');
$logger->info('this is an info message line');
$logger->debug('this is a debug message line');

Pass context array to the methods, which will be passed to the server as well

# define context to pass along with the message
$context = ['time' => microtime(true)];
# write log message with context
$logger->warning('this is a warning message', $context);

Catch errors

Phplogger has an error handler class which allows to register $logger object to catch and log errors. This will catch both PHP Errors and Unhandled Exceptions.

# register $logger for error collection

NOTE: It's recomender to register only one $logger object for error collection

Format exceptions and errors

Phplogger has special formatter available for PHP Error & Exception handling. The format class creates a special loggable object, which you can use for custom error processing.

$loggable = \PhpLogger\Format\Format::createFromException($exception);
$logger->critical($loggable->toString(), $loggable->toArray());


Phplogger supports integration with multiple frameworks and logging approaches. For more information see the learning page.

Logs Delivery

Each $logger object contains a buffer which collects all of the logs into memory. When the buffer size is exceeded or the PHP script execution ends, the data gets transferred to the server. In case the data transfer fails - the buffer is discarded. There are additional mechanisms that prevent logs from being send to a faulty server. They protect the PHP application from performance degradation.


In case of ANY issues with the library please create an Issue on GitHub or contact by email