Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PapaRascal2020's avatar

PHPUnit Alias Windows

In case anybody is getting fed up with typing out on Windows CMD the full path to PHPUnit within their project to do testing in Laravel type the following command into CMD/PHPStorm Terminal:

"doskey phpunit=.\vendor\bin\phpunit"

It took me a while to find this so thought I would post it here in case anyone else would like to know :)

0 likes
5 replies
Braunson's avatar

If you are using composer in your project, you can create an alias for it also i.e. composer phpunit.

1 like
Braunson's avatar

@oleonides You have many options:

  1. Create an alias in Windows like @paparascal2020
  2. Using composer, globally install phpunit so you access to phpunit
  3. Create a composer "script" in the composer.json file. Like so.. (you would run composer phpunit or whatever the key value you set it.
{
    "scripts": {
        "phpunit": "vendor/bin/phpunit"
    },
}
1 like
Tray2's avatar

The easier in my book would be to create a bat file and place that in the path.

Please or to participate in this conversation.