Home » Php » netbeans – What PHP IDE's support the Facebook XHP extension?

netbeans – What PHP IDE's support the Facebook XHP extension?

Posted by: admin July 12, 2020 Leave a comment

Questions:

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

How to&Answers:

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.

Answer:

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

Answer:

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

Answer:

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.

Answer:

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.

Answer:

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