How To Install php-phpspec on CentOS 7

In this tutorial we learn how to install php-phpspec on CentOS 7. php-phpspec is Specification-oriented BDD framework for PHP

Introduction

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

What is php-phpspec

phpspec is a tool which can help you write clean and working PHP code using behaviour driven development or BDD. BDD is a technique derived from test-first development. BDD is a technique used at story level and spec level. phpspec is a tool for use at the spec level or SpecBDD. The technique is to first use a tool like phpspec to describe the behaviour of an object you are about to write. Next you write just enough code to meet that specification and finally you refactor this code.

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

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

sudo yum -y install php-phpspec

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

sudo dnf -y install php-phpspec

How To Uninstall php-phpspec on CentOS 7

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

sudo dnf remove php-phpspec

References

Summary

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