So I have had the pleasure to use a Windows machine again recently. When I say pleasure, I mean I had multiple pain points so far, though some of them do not stem from Windows itself and come from a strict IT department. Anyways back to Windows, I am using it at a contract position currently and had to setup up some items so I could even use a PHP autocomplete extension in VS Code. Here is what I had to do to get up and running with PHP, Git and Node.js for compiling my Sass. I included Composer because it’s just a nice thing to have 😊.
- Use Chocolatey to install PHP, composer, node (LTS only), and git.
- Chocolatey is a command line Windows Package Manager.
- PHP is needed for linting purposes in an IDE/Editor
- Composer is a PHP Dependency Manager (it’s a nice to have, not needed, but preferable).
- Node is needed for processing Sass.
- Git is needed to track changes and to use for Gitlab.
- There are GUI Git solutions such as:
- GitKraken : Freemium Solution
- Source Tree : Free Solution
- Tower : Paid Solution
- There are GUI Git solutions such as:
- PHP install script
choco install php
, keep hitting Y until install is finished. - Composer install script
choco install composer
, hit Y to start install when asked. - Node install script
choco install nodejs-lts
, hit Y to start install when asked. - Git install script
choco install git
, hit Y to start install when asked. - Setting up git
git config --global user.name "First Name Last Name"
git config --global user.email "your@emailaddress.com"
- Point VS Code to your PHP version (version 7 should be on your machine).
- Open the command palette
ctl shift p
, type settings - Select Open Settings (JSON), not Open Settings (UI)
- Inside the curly braces add
"php.validate.executablePath": "c:/folder/php73/php.exe",
.- This path is dependent on where you have installed PHP.
- Make sure your slashes are Forward Slashes as VS Code will not interpret Backslashes correctly and will error.
- Open the command palette
- Right click on your Start Menu, select Settings.
- Type Advanced Settings in the search field.
- In Advanced Settings select Environment Variables.
- Select the Path variable (in your user or system list).
- Click Edit.
- Click New.
- Paste your PHP path.
- Click OK, three times.
- Close your System Window.
- Test in your command prompt with
php -v
to show what version of php is installed.