The simplest way to get PHPUnit is to download PHPUnit’s PHP Archive (PHAR), which bundles all the necessary components PHPUnit needs (plus some optional ones) into a single file:
To use the PHP Archive (PHAR) you need the phar extension.
To use PHAR’s —self-update feature you need the openssl extension.
If the Suhosin extension is enabled, you need to allow PHAR execution in php.ini:
suhosin.executor.include.whitelist = phar
To install PHAR globally:
$wget https://phar.phpunit.de/phpunit.phar$chmod +x phpunit.phar$sudo mv phpunit.phar /usr/local/bin/phpunit$phpunit --versionPHPUnit x.y.z by Sebastian Bergmann and contributors.
You can also just use the downloaded PHAR file directly:
$wget https://phar.phpunit.de/phpunit.phar$php phpunit.phar --versionPHPUnit x.y.z by Sebastian Bergmann and contributors.
Overall, installing PHAR on Windows is the same process as manually installing Composer on Windows:
Download address: https://phar.phpunit.de/
- Create a directory for PHP's binary executable, for example
C:\bin - Append
;C:\binto thePATHenvironment variable (related help) - Download https://phar.phpunit.de/phpunit.phar and save the file to
C:\bin\phpunit.phar - Open a command line (for example, press Windows+R » type
cmd» ENTER) - Create an outer wrapper batch script (you end up with
C:\bin\phpunit.cmd):C:\Users\username>cd C:\binC:\bin>echo @php "%~dp0phpunit.phar" %* > phpunit.cmdC:\bin>exit - Open a new command line window and confirm that you can run PHPUnit from any path:
C:\Users\username>phpunit --versionPHPUnit x.y.z by Sebastian Bergmann and contributors.

