How To Install php-analog on Ubuntu 18.04

In this tutorial we learn how to install php-analog on Ubuntu 18.04. php-analog is PHP micro logging package

Introduction

In this tutorial we learn how to install php-analog on Ubuntu 18.04.

What is php-analog

php-analog is:

PHP 5.3+ micro logging class that can be extended via closures. Includes several pre-built handlers including file, mail, syslog, HTTP post, and MongoDB.

Analog also comes with over a dozen pre-written handlers in the Analog/Handlers folder, with examples for each in the examples folder. These include:

  • Amon - Send logs to the Amon server monitoring tool
  • Buffer - Buffer messages to send all at once (works with File, Mail, Stderr, and Variable handlers)
  • ChromeLogger - Sends messages to Chrome Logger browser plugin
  • File - Append messages to a file
  • FirePHP - Send messages to FirePHP browser plugin
  • GELF - Send message to the Graylog2 log management server
  • LevelBuffer - Buffer messages and send only if sufficient error level reached
  • Mail - Send email notices
  • Mongo - Save to MongoDB collection
  • Multi - Send different log levels to different handlers
  • Null - Do nothing
  • Post - Send messages over HTTP POST to another machine
  • Stderr - Send messages to STDERR
  • Syslog - Send messages to syslog
  • Threshold - Only writes log messages above a certain threshold
  • Variable - Buffer messages to a variable reference.

So while it’s a micro class, it’s highly extensible and very capable out of the box too.

There are three methods to install php-analog on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install php-analog Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install php-analog using apt-get by running the following command:

sudo apt-get -y install php-analog

Install php-analog Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install php-analog using apt by running the following command:

sudo apt -y install php-analog

Install php-analog Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install php-analog using aptitude by running the following command:

sudo aptitude -y install php-analog

How To Uninstall php-analog on Ubuntu 18.04

To uninstall only the php-analog package we can use the following command:

sudo apt-get remove php-analog

Uninstall php-analog And Its Dependencies

To uninstall php-analog and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove php-analog

Remove php-analog Configurations and Data

To remove php-analog configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge php-analog

Remove php-analog configuration, data, and all of its dependencies

We can use the following command to remove php-analog configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge php-analog

References

Summary

In this tutorial we learn how to install php-analog package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.