33

I tried this IDE and I like it. Only problem is that if Im in a project that has some PHP in it, its confusing to see plain black text instead of correct PHP highlight.

I dont need brutal PHP autocomplete or so, but a syntax highlight. Is it possible to achieve in Webstorm?

Or the only option is to use PHPStorm?

Cœur
  • 37,241
  • 25
  • 195
  • 267
zsitro
  • 1,812
  • 3
  • 24
  • 34

6 Answers6

68

Why not

File Menu > Settings > File Types > click 'PHP files' > click 'Add' in the bottom screen > enter '*.php'

(instead of html with .php)

Joshua Wooward
  • 1,508
  • 2
  • 10
  • 12
21

Associate the .php file extension to HTML file cause the IDE highlight at least HTML code correctly.

File Menu > Settings > File Types > click 'HTML files' > click 'Add' in the bottom screen > enter '*.php'.

Delmo
  • 2,188
  • 2
  • 20
  • 29
  • Thanks, but this is the same answer as the previous. – zsitro Jan 18 '13 at 07:50
  • No problem but It was not exactly same answer. The first is more complex and deep. My answer is a shorcut to avoid spend enough time redefining whole php file format. Regards!!! – Delmo Jan 18 '13 at 16:31
  • 2
    Yes, it wasn't the same answer. It's a right answer, it could help people to add PHP highlight support, without any PHP Storms. – Rantiev Dec 26 '13 at 12:12
  • 2
    After lot of search... really the better solution for project that use small part of php with html. ty. – Beber Feb 24 '15 at 16:16
  • 1
    Yes, this way the html intellisense is working, which helped me with my WP theme development. – Havrl May 09 '15 at 06:49
19

UPDATE: since TextMate bundles support was added to the IDE, you can add any language syntax highlighting to the IDE if there is TextMate bundle for it. See my reply about adding Ruby highlighting, it would be the same for PHP, just the different bundle.


Your best option is to use PhpStorm. Another option is to create your custom file type for basic syntax highlighting.

Community
  • 1
  • 1
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 3
    I ran into the same issue and I didn't found any other way than using PHPStorm, which is basically WerbStorm + PHP support. – Diosney Aug 13 '13 at 00:57
  • 1
    Where has the TextMate bundles support been added to the WebStorm IDE? I ended up using Sublime text 2 for the small amount of PHP coding I need to do. – Meli Aug 07 '15 at 01:27
  • 8
    It's a bit weird that webstorm doesn't even highlight php code, when even the simplest free tools will do that... Not impressed! – Kokodoko Feb 01 '16 at 13:57
7

A late reply, but this worked for me:

use this textmate bundle: https://github.com/textmate/php.tmbundle

Then go to settings > File Types and associate *.php to PHP files.

Hope it helps.

  • In file types I get an error: This wildcard is reserved for 'Files supported via TextMate bundles' filetype and cannot be reassigned – Žilvinas Mar 08 '19 at 21:54
2

I tried the textmate bundle but it seems that there is an issue. I wasn't able to get highlighting. I think it is an unsolved bug, so I wonder if someone figured out how to use it.

http://youtrack.jetbrains.com/issue/WEB-11065

http://youtrack.jetbrains.com/issue/RUBY-14273

So I think I have to use PHPStorm to get basic syntax highlighting. Thats sad :/

tschoartschi
  • 1,453
  • 2
  • 14
  • 23
1

This questions describes how to install textmate plugin which gives you syntax highlighting:

Is it possible to get Ruby syntax highlighting in PHPStorm?

The only difference is that you want to use this bundle: https://github.com/textmate/php.tmbundle (but maybe there are better ones)

Community
  • 1
  • 1
Maciej Jankowski
  • 2,794
  • 3
  • 26
  • 33