How To Install php-PhpCollection on CentOS 7

In this tutorial we learn how to install php-PhpCollection on CentOS 7. php-PhpCollection is General purpose collection library for PHP

Introduction

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

What is php-PhpCollection

This library adds basic collections for PHP. Collections can be seen as more specialized arrays for which certain contracts are guaranteed. Supported Collections * Sequences ** Keys ** Values ** Classes * Maps ** Keys ** Values ** Classes * Sets (not yet implemented) ** Keys ** Values ** Classes General Characteristics * Collections are mutable (new elements may be added, existing elements may be modified or removed). Specialized immutable versions may be added in the future though. * Equality comparison between elements are always performed using the shallow comparison operator (===). * Sorting algorithms are unstable, that means the order for equal elements is undefined (the default, and only PHP behavior). Autoloader

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

Install php-PhpCollection 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-PhpCollection using yum by running the following command:

sudo yum -y install php-PhpCollection

Install php-PhpCollection 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-PhpCollection using dnf by running the following command:

sudo dnf -y install php-PhpCollection

How To Uninstall php-PhpCollection on CentOS 7

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

sudo dnf remove php-PhpCollection

References

Summary

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