VS Code Essentials for PHP Development with Git Workflow

Posted . Visible to the public.

Set up for

  • development and production servers
  • local and remote git repo
  • multiple coders

Required VS Code Extensions

  1. ftp-sync ver 0.3.3, do not use ver 0.3.9
  2. GitLens latest ver
  3. PHP Intelephense latest ver

ftp-sync setup

To ftp local changes to remote server for testing. The latest ver 0.3.9 has some problems, so downgrade to version to 0.3.3:

Image

The json config:

  1. [vscode] Hit F1
  2. [vscode] Input: ftp-sync: Init
  3. [vscode] File: ftp-sync.json
{
    "remotePath": "/home/web/public_html/magento/emgsihe_devel",
    "host": "10.1.xx.xx",
    "username": "xxatxx",
    "password": "",
    "port": xxx22,
    "protocol": "sftp",
    "uploadOnSave": true,
    "passive": false,
    "debug": false,
    "privateKeyPath": "D:/Work/Scicom/stars_fz_openssh",
    "ignore": [
        "\\.vscode",
        "\\.git"
    ]
}

You need to setup the above for each project.

Power of GitLens

Who did what at a glance by hovering over the line of code:

Image

Explore the blue links in the popup, eg, you can open the commit in remote by clicking on the arrow icon on the popup window.

Power of PHP Intelephense

This is packed with all kinda goodies:

  1. Syntax check, warning and error highlighting
  2. Hover over a class and hit F12 to open and view the file
  3. Explore on your own

Image

Start Using VS Code

The easiest way to create a vscode workspace is use a terminal and cd to the root of your project and type in this command: code .

That's it. Enjoy!

Profile picture of kiatng
kiatng
Last edit
kiatng
Tags
Posted by kiatng to Tricks (2019-05-16 02:32)