There are several ways to integrate PHPLogger into your application. The simplest is to install it using composer. In case you use more advanced logging libraries or frameworks, PHPLogger ingrates with the most popular of the quite easily.


Installing PHPLogger in composer is very straight forward: you run the composer command inside your project and that's that.

composer require phplogger/phplogger

After the composer installed phplogger client, you need to initialize the client using authetnication token and start writing the logs.

# add autoloader
include __DIR__ . '/vendor/autoload.php';

# create logger object
$token = 'd173f174f8aa6793ab8f8b6c9286ec9834a33ee6';
$logger = new \PhpLogger\Logger($token);

# 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');

PHPLogger Client is PSR-3 standard compatible. More information regarding the standard can be found here.

Note that creating multiple instances will create multiple


A more advanced way of handling application logging would be using Monolog library.

Monolog sends your logs to files, sockets, inboxes, databases and various web services. Special handlers allow you to build advanced logging strategies. Installation instructions available on GitHub.

After installing Monolog with composer, install PHPLogger client as well.

composer require phplogger/phplogger

PHPLogger client provides special handler to be used with monolog.

use Monolog\Logger;

# add autoloader
include __DIR__ . '/vendor/autoload.php';

# define PHPLogger authentication token
$token = 'd173f174f8aa6793ab8f8b6c9286ec9834a33ee6';

# create log channel
$logger = new Logger('channel_01');
$logger->pushHandler(new PhpLoggerHandler($token));

# write records to log
$logger->emergency('this is an emergency message line');
$logger->alert('this is an alert message line');

We strongly advice against having multiple PhpLoggerHandler objects in your application. The best approach to application logging would be to have a single object of PhpLoggerHandler added to multiple (if not all of the) channels.

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

# add autoloader
include __DIR__ . '/vendor/autoload.php';

# define PHPLogger authentication token
$token = 'd173f174f8aa6793ab8f8b6c9286ec9834a33ee6';
#phpLoggerHandler = new PhpLoggerHandler($token);

# create first channel
$channel_01 = new Logger('channel_01');
$channel_01->pushHandler(new StreamHandler('php://stdout'));

# create second channel
$channel_02 = new Logger('channel_02');
$channel_02->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));

# write records to several channels
$channel_01->emergency('this is an emergency message line');
$channel_02->alert('this is an alert message line');

PHPLogger would capture all messages from all of the channels effectively into one buffer and collect them right away.


Symfony is a set of PHP Components, a Web Application framework. Symfony comes with Monolog support by default, thus works well with PHPLogger as well.

To get started, you need to install Symfony Framework first. Then install PHPLogger client via composer.

composer require phplogger/phplogger

To actually get started we need to define PhpLoggerHandler as a service in symfony configurations. First and the only argument of the handler's constructor will be the authentication token of your account.

        class: PhpLogger\Monolog\PhpLoggerHandler
        arguments: ['d173f174f8aa6793ab8f8b6c9286ec9834a33ee6'] # authentication token

The last step is to define this service as one of the monolog service. For the best application log collection experience we recommend adding all of the channels except for "event".

            type: service
            id: phplogger.handler
            channels: ["!event"]

Now all of the default system logs and your custom written logs will appear in the PHPLogger viewer panel.