What PHP IDE's support the Facebook XHP extension? [closed]
Asked Answered
D

6

7

The Facebook XHP extension introduces what are basically XML literals (well, XHTML literals) to the PHP language, allowing syntax like the following:

$foo = <div>hello</div>;

$foo = <div>
       hello
       </div>;

$foo = 'hello';
echo <div>{$foo}</div>; // outputs <div>hello</div>

$foo = 'hello';
echo <div>{substr($foo, 0, 2)}</div>; // outputs <div>he</div>

The biggest problem is that I cannot find an IDE that supports this syntax without flagging it as a syntax error.

I'm told that Facebook generally uses vim or emacs for development but I'm hoping for a more full-blown IDE that supports this syntax. At present, Netbeans 6.9, 7.0 M2, and Zend Studio 8 all flag this syntax as an error even though it executes fine on PHP with the XHP extension enabled.

Suggestions for an editor or plugin to an editor that allows this to work without syntax errors?

Info about XHP: https://github.com/facebook/xhp/wiki

Devin answered 12/11, 2010 at 6:9 Comment(1)
More than 3 years have passed since this question. I'm using NetBeans IDE 7.4 - it still doesn't support XHP syntax. Nor I find a decent IDE that supports XHP syntax.Scorify
S
3

Try netbeans, go to Tools > Options find tab Miscellaneous > Files. Choose your Extension or click new. Remember insert ignored files pattern should be insert, if not you will get error syntax.

Sallee answered 25/10, 2012 at 5:5 Comment(0)
K
2

this thread is pretty old, but I hope this can help somebody else! I tried the code in aptana studio3 and works!

Kristiankristiansand answered 20/11, 2010 at 5:22 Comment(1)
Doesn't work for me in Aptana - marks it red...Mccowan
B
2

At Facebook we sometimes use SublimeText or Textmate. Both somewhat inherently support XHP. They don't necessarily understand it, but they don't consider it invalid syntax. As far as I know no one at Facebook has built any extensions to IDEs to handle the syntax better, mostly likely because we do use

Burette answered 29/1, 2013 at 16:20 Comment(0)
F
0

I never used this extension I just pasted your code in a PHP page in PHPDesigner 7 and it did not considered it an error.

I just love this app: http://www.mpsoftware.com/

Try it and see if it suits your needs.

Fossil answered 12/11, 2010 at 11:15 Comment(0)
P
0

I just searched the JetBrains website for this feature (in PHPStorm): They say it is very complex to provide this and so it will not come soon ( http://youtrack.jetbrains.com/issue/WI-1208 ). I think that will be the same on all other major IDEs.

What comes into my mind: Emacs. I've just started to learn Emacs because of the possibility to extend it a very easy way, just for DSLs like XHP (which is indeed an embedded DSL). Here's a good tutorial for Emacs http://david.rothlis.net/emacs/howtolearn.html.

Periostitis answered 24/4, 2012 at 9:19 Comment(0)
E
0

I doubt this will work with the Cloud9 IDE but they accept user given features all the time. I requested syntax highlighting for 2 languages, and now they are both supported. Give it a try.

Official site: https://c9.io/

Github site: https://github.com/ajaxorg/cloud9

Feature requests: http://support.cloud9ide.com/forums/20010046-feature-requests

Eddi answered 25/10, 2012 at 4:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.