How To Install php-vlucas-phpdotenv on CentOS 7

In this tutorial we learn how to install php-vlucas-phpdotenv on CentOS 7. php-vlucas-phpdotenv is Loads environment variables from .env

Introduction

In this tutorial we learn how to install php-vlucas-phpdotenv on CentOS 7.

What is php-vlucas-phpdotenv

Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically. This is a PHP version of the original Ruby dotenv [1]. Autoloader [1] https

We can use yum or dnf to install php-vlucas-phpdotenv on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install php-vlucas-phpdotenv.

Install php-vlucas-phpdotenv on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install php-vlucas-phpdotenv using yum by running the following command:

sudo yum -y install php-vlucas-phpdotenv

Install php-vlucas-phpdotenv on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install php-vlucas-phpdotenv using dnf by running the following command:

sudo dnf -y install php-vlucas-phpdotenv

How To Uninstall php-vlucas-phpdotenv on CentOS 7

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

sudo dnf remove php-vlucas-phpdotenv

References

Summary

In this tutorial we learn how to install php-vlucas-phpdotenv on CentOS 7 using yum and dnf.