[Tutorial] How to add wp-cli to Laragon
Adding additional command line tool like
wp-clito Laragon is easy. We will use
C:\laragon\usr\binto store our tool. Here's how:
Download wp-cli.phar and put it to
Create a file called
C:\laragon\usr\bin\wp-cli.pharwith following content:
@ECHO OFF php "%~dp0wp-cli.phar" %*
That's all folks!
To test, open Laragon's Terminal (CTRL + ALT + T), and type:
You should see something like this: WP-CLI 1.5.1
To check info, type:
Or you can do the lazy way (paste it in Laragon's Terminal) and enter:
cd C:\laragon\usr\bin && curl -L -O https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && echo @ECHO OFF > wp.bat && echo php "%~dp0wp-cli.phar" %* >> wp.bat
Should I add
C:\laragon\usr\binto the PATH variable in order to use it from the normal windows command prompt/GIT bash?
No, you should not. Because you also need to add PHP to PATH.
You may think it is not a matter. However, what if you want to change to another PHP version in the future?
Doing things like that in a long term will pollute your PATH.
Laragon's Terminal manages PATH for us. Therefore, we can add another PHP, Apache, Nginx, Node.js, Ruby, Python, Golang, Java, MongoDB, PostgreSQL,... without any headache