How to install php-code-coverage on Windows?

How to install php-code-coverage library on Windows?

Hi Rhian,

You need to run the following command to install the php-code-coverage library.

composer require phpunit/php-code-coverage

The php-code-coverage library can be added as a per-project dependency using the Composer module. A better way is to add the library requirement in the existing composer.json of the project.

{
   "require":{
     "php":">=7.1",
     "phpunit/phpunit-selenium": "*",
     "php-webdriver/webdriver":"1.8.0",
     "symfony/symfony":"4.4"
   },
   "require-dev": {
      "phpunit/php-code-coverage": "^9.1",
      "phpunit/phpunit": "^9.3",
      "pcov/clobber": "^2.0"
   }
}

Here, I have adeed an extra request for installing php-code-coverage-library. Now, run the command composer require on the terminal and press ‘Enter’ twice. This will install the phpunit/php-code-coverage library.

Hope this helps!

5 Likes

Thanks Shahzebh for quick help

1 Like