Turn Sublime Text into An Awesome IDE for Laravel / PHP with LSP and Intelephense

Jian Jye
2 min readAug 14, 2020

I like Sublime Text. I really do. I like how fast it is, how versatile it is, and overall I have a very good experience with it.

Despite how popular VS Code has become recently, I find it just a little slow to my liking. Then there is also PHPStorm which is feature-packed, but a little heavy to my liking.

So what if we can add some IDE features to an ultra-fast editor? That would be great isn’t it? Well that’s totally possible!

  1. Go to your Terminal app and install intelephense by running: npm -g i intelephense .
  2. Open the command palette in Sublime Text and run Package Control: Install Package, then select LSP and LSP-intelephense to install both packages.
  3. Enable the server by running LSP: Enable Language Server in command palette. Then choose lsp-intelephense from the menu.
  4. Go to LSP > Servers > LSP-intelephense under Package Settings, copy and paste the following json into your settings file to setup LSP and Intelephense:
{
"enabled": true,
"command": [
"intelephense",
"--stdio",
],
"scopes": ["source.php", "embedding.php"],
"syntaxes": ["Packages/PHP/PHP.sublime-syntax"],
"languageId": "php",
"initializationOptions": {
"clearCache": false,
"licenceKey": "",
},
}

Now restart your Sublime Text and you are all done! You should now be able to autocomplete accurately.

Auto-completing for a model called Node in Laravel.

--

--

Jian Jye

I write about Laravel, PHP, and web development related articles.