I just spent an hour trying to figure out how to format PHP in Kate and can’t do it. I downloaded phpcbf.phar and it works on local files, naturally, but can’t use it for remote files which is the majority of how I work (ftp through Dolphin.) So, I need one of two things (I think):
Some sort of tool I can use through Kate to format PHP file in the editor
or
Figure out if Kate is using a local folder for tmp storage of the file from ftp, and what that folder is.
I love Kate, but this is kind of a show stopper for me. I’ve got a workaround but it’s several steps. In VSCode it’s one keyboard shortcut, but I hate it, especially compared to Kate.
The easiest way to do this would be to first select the whole documents, then go to
Tools - Filter Through Command
, and putPATH/YO/phpcbf.phar -
(note the ending-
- this is necessary), and click OK. Your document should now be formatted.If you need to run this a lot and want to be quicker, you can set up an external tool through
Tools - External Tools - Configure...
, and add a new tool there. Here’s an example setup:The “best” and “official” way to do this would be to install
phpactor
LSP server with PHP-CS-Fixer integration, however this does not work on remote files.