How To Install php-psr-log on Ubuntu 18.04

In this tutorial we learn how to install php-psr-log on Ubuntu 18.04. php-psr-log is common interface for logging libraries

Introduction

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

What is php-psr-log

php-psr-log is:

The main goal is to allow libraries to receive a Psr\Log\LoggerInterface object and write logs to it in a simple and universal way. Frameworks and CMSs that have custom needs MAY extend the interface for their own purpose, but SHOULD remain compatible with this document. This ensures that the third-party libraries an application uses can write to the centralized application logs.

The LoggerInterface exposes eight methods to write logs to the eight RFC 5424 levels (debug, info, notice, warning, error, critical, alert, emergency).

A ninth method, log, accepts a log level as first argument. Calling this method with one of the log level constants MUST have the same result as calling the level-specific method. Calling this method with a level not defined by this specification MUST throw a Psr\Log\InvalidArgumentException if the implementation does not know about the level. Users SHOULD NOT use a custom level without knowing for sure the current implementation supports it.

Note that this is not a logger of its own. It is merely an interface that describes a logger. See the specification for more details.

There are three methods to install php-psr-log 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-psr-log 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-psr-log using apt-get by running the following command:

sudo apt-get -y install php-psr-log

Install php-psr-log Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install php-psr-log

Install php-psr-log 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-psr-log using aptitude by running the following command:

sudo aptitude -y install php-psr-log

How To Uninstall php-psr-log on Ubuntu 18.04

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

sudo apt-get remove php-psr-log

Uninstall php-psr-log And Its Dependencies

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

sudo apt-get -y autoremove php-psr-log

Remove php-psr-log Configurations and Data

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

sudo apt-get -y purge php-psr-log

Remove php-psr-log configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge php-psr-log

References

Summary

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