9951 explained code solutions for 126 technologies


phpunitHow to install PHPUnit from Packagist?


  1. Install Composer if you don't have it already.
  2. Create a composer.json file in the root of your project and add the following code:
{
    "require-dev": {
        "phpunit/phpunit": "^8.5"
    }
}
  1. Run composer install in the root of your project.
  2. Add the following line to your php.ini file:
zend_extension=xdebug.so
  1. Run phpunit in the root of your project to verify the installation.

You should see the following output:

PHPUnit 8.5.2 by Sebastian Bergmann and contributors.

Usage:
  phpunit [options] UnitTest [UnitTest.php]
  phpunit [options] <directory>

...

Edit this code on GitHub