How To Install php-phpspec-prophecy on CentOS 7

In this tutorial we learn how to install php-phpspec-prophecy on CentOS 7. php-phpspec-prophecy is Highly opinionated mocking framework for PHP

Introduction

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

What is php-phpspec-prophecy

Prophecy is a highly opinionated yet very powerful and flexible PHP object mocking framework. Though initially it was created to fulfil phpspec2 needs, it is flexible enough to be used inside any testing framework out there with minimal effort.

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

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

sudo yum -y install php-phpspec-prophecy

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

sudo dnf -y install php-phpspec-prophecy

How To Uninstall php-phpspec-prophecy on CentOS 7

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

sudo dnf remove php-phpspec-prophecy

References

Summary

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