Configure VS Code for PHP Development Workflow

Posted . Visible to the public.
  1. [browser][windows] Download and install WampServer, save the application in the work folder (D:/Work/wamp64); if encounter error on missing VCRUNTIME140.dll, download it from MS Show archive.org snapshot , download either x64 or x86, install as admin; if still error after installing, then download the other file and install.
  2. [browser][windows]Download and install VS Code.
  3. [vscode] Configure PHP linting:
    1. File > Preferences > User Settings
    2. on the right window settings.json, see sample code 1
    3. The path can also be written as "D:/Work/wamp64/bin/php/php5.6.25/php.exe"
  4. [vscode] Define the workspace:
    1. File > Open Folder...
    2. Select the folder that contains the workspace (D:\Work\Sxxxm\stars)
    3. Click the Explorer, first button on the left menu bar
  5. [vscode] Click the Extensions, the last button on the left menu bar and install extension Crane
  6. [vscode] Install extension ftp-synch
    1. F1 > type "init" > select Ftp-synch: Init,
    2. in the window ftp-synch.json, see sample code 2
  7. [vscode] In the Explorer pane, navigate and open a PHP file, do some editing, and ctrl-s to save, make sure that the changes is uploaded/ftp to the server
  8. [vscode] Git Commit
    1. on the blue status bar at the bottom, you can see the current branch
    2. click on the Git, the third button on the left menu bar
    3. you can type a commit message and commit

sample code 1:

    {
        "php.validate.executablePath": "D:\\Work\\wamp64\\bin\\php\\php5.6.25\\php.exe",
        "php.validate.run": "onType"
    }

sample code 2:

{
    "remotePath": "/home/web/public_html/magento/emgsihe_devel",
    "host": "10.1.57.40",
    "username": "kiat",
    "password": "",
    "port": 26833,
    "protocol": "sftp",
    "uploadOnSave": true,
    "passive": false,
    "debug": false,
    "privateKeyPath": "D:/Work/Sxxxx/stars_fz_openssh",
    "ignore": [
        "\\.vscode",
        "\\.git"
    ]
}

The privateKeyPath must be in OpenSSH format. Use PuTTYgen > Conversions to export and save the file.

Profile picture of kiatng
kiatng
Last edit
kiatng
Posted by kiatng to Tricks (2016-11-25 10:05)