Windows
Globally installing the PHAR involves the same procedure as manually installing Composer on Windows:
-
Create a directory for PHP binaries; e.g.,
C:in
-
Append
;C:in
to yourPATH
environment variable (related help) -
Download https://phar.phpunit.de/phpunit.phar and save the file as
C:inphpunit.phar
-
Open a command line (e.g., press Windows+R » type
cmd
» ENTER) -
Create a wrapping batch script (results in
C:inphpunit.cmd
):C:Usersusername>
cd C:in
C:in>
echo @php "%~dp0phpunit.phar" %* > phpunit.cmd
C:in>
exit
-
Open a new command line and confirm that you can execute PHPUnit from any path:
C:Usersusername>
phpunit --version
PHPUnit x.y.z by Sebastian Bergmann and contributors.