9951 explained code solutions for 126 technologies


phpunitHow to install PHPUnit with Composer?


  1. Install Composer on your system.
  2. Create a composer.json file in the root of your project and add the following code:
{
    "require-dev": {
        "phpunit/phpunit": "^7.5"
    }
}
  1. Run composer install in the root of your project.
  2. Add the vendor/bin directory to your PATH environment variable.
  3. Run phpunit --version to verify the installation.

Output example

PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

Edit this code on GitHub