Recently having moved to BBEdit, one thing that drove me crazy was the formatting using intelliphense (PHP) would automatically use PSR12 (default) where it puts the curly brace on a new line.

Say what you will about code style and all but I wanted K&R.

In VSCode this is trivial, edit the config, add a line and done. In BBEdit, not so quick!

The setup

Once you have intelliphense set up properly in BBEdit - see this page and search for “php”:

Got to ~/Library/Application Support/BBEdit/

You should see a folder Language Server, in there you’ll find probably something for intelliphense such as storage.

See if there is a Configuration folder or create it. In there, create a php.json or whatever you’d like to call it, to hold your intelliphense config.

So the file is ~/Library/Application Support/BBEdit/Language Servers/Configuration/php.json

Here is my final json


				"format": {"braces": "k&r"}

Change the k&r to your preferred format. I’ve used this emacs reference to find the settings name:

Save it, restart BBEdit.

The usage

  • Open the BBEdit preferences (cmd+comma),
  • go to Languages and at the bottom in Language-specific settings:
  • click the +, select PHP in HTML
  • double click the new item in the list
  • go to the Server tab
  • Configuration: pick your json name, e.g. php

Screenshot 1 of BBEdit LSP settings Screenshot 2 of BBEdit LSP settings

Restart BBEdit and the next time you format code, your braces should be as you intended!