Can I use Facebook's hiphop with frameworks like Zend Framework, cakephp, symfony
Asked Answered
B

6

10

Yesterday Facebook launched HipHop, a sourcecode-converter from php to c++. The set of php functions and constructions is more limited than in standard php.

Are the current popular php frameworks (ZF, CakePHP, symfony) compatible with HipHop? If not, which parts of these frameworks are not usable?

Bittern answered 3/2, 2010 at 7:13 Comment(0)
P
9

If I'm not mistaken, HipHop has not been released yet -- even the wiki page linked from the Facebook annoucement yesterday is not up yet.

So, it's going to be a bit hard to answer, right now.


I suppose it'll all depend on :

  • The features used by the Frameworks -- like already said here and there, stuff like eval is not supported by HipHop
  • The PHP extensions used by the Frameworks : only a couple of those have been ported by Facebook to HipHop.
  • Depending on the Frameworks and your specific needs, maybe/probably some subsets of the Frameworks you are using will be supported, even if not every available components... I suppose time will tell which ;-)
Prase answered 3/2, 2010 at 7:52 Comment(0)
M
5

With at least ZF and Symfony being used for Enterprise level applications, chances are pretty good they will run with HipHop. If not now, then sooner or later. However, the question is not so much if they can run with these frameworks, but how your supporting IT architecture looks like.

HipHop is for scaling large multiserver high traffic sites like Facebook. In your regular web application, you will likely get no advantage out of it. Just continue to use memcache and APC.

See these related articles:

Matchless answered 3/2, 2010 at 8:31 Comment(3)
If a framework uses eval, it may struggle to use HipHop. I suppose if HipHop gains traction, this constraint will move any frameworks to stop using eval in the futureBaize
@Jon Yes. That's what I wanted to imply with if not now ... and what it says in the linked articles. ZF doesn't use any eval afaik, so it might work. Only might, because it is not only eval. It's also any extensions that Facebook doesn't use atm.Matchless
Did any major PHP framework actually give up the use of eval?Greysun
A
2

While I'm sure most of us are curious about what HipHop is going to be, I know it will not be a replacement for PHP - it's very much a niche product: unless you're running a large server farm then the performance benefits vs the maintenance costs just wouldn't justify it.

Perhaps it might be an interesting alternative to use encoded PHP for some people - but again this introduces even greater maintenance overheads. The only low-volume scenario where a compiled PHP would seem to make a lot of sense is for embedded devices (where the software exists to support the hardware and not vice versa) and for very high security installations (where its not a good idea to have a interpreter available).

It's far to early to be able to say what PHP software will work with it. However even once thats established, I'd want to see a solid commitment from any supplier that they were going to explicitly support HipHop in the future before I switched.

C.

Autotype answered 3/2, 2010 at 9:41 Comment(2)
...and I expect it would be useful for standalone apps too. Found this video which I'm currently watching ustream.tv/recorded/4409735Autotype
If someone is creating a new web-app which expects a very high volume of traffic so that performance may be a concern, maybe they should consider using something other than PHP in the first place. But in 99% of cases, you're not going to face these problems... FB has 200+ million users.Fey
P
2

I won't repeat what has already been said, I'll just add that as soon as HipHop is released you can count on the opensource community to submit patches for your favorite framework for increased compatibility with HipHop.

Also, one good way to test whether your favorite framework is compatible or not would be to launch the test suite using HPHPi (you then know where to concentrate your patching effort ;).

Phonetist answered 3/2, 2010 at 11:3 Comment(0)
W
2

Searching for 'eval' gives a lot of false positives, as you get hits for the word "evaluate" in comments, or escapeValue if the search isn't case sensitive, etc.

If you search for 'eval(' in ZF 1.11 you'll find in once in Zend/Serializer/Adapter/PhpCode.php on line 59, in a method that unserializes stored PHP code. The method isn't a part of the MVC architecture, db component, and actually isn't used anywhere else in the framework (Zend_Serializer_Adapter_PhpCode isn't instantiated anywhere else in the code base).

So if eval breaks your ZF-Hip Hop app, don't use Zend_Serializer_Adapter_PhpCode, or eval in your consumer code.

Wormwood answered 23/2, 2011 at 16:29 Comment(0)
A
1

Simple answer: I don't think it would.

Just saw this on hiphop page: https://github.com/facebook/hiphop-php/wiki/

"You keep coding in simpler PHP, then HipHop executes your source code in a semantically equivalent manner and sacrifices some rarely used features – such as eval() – in exchange for improved performance."

Did a search for 'eval' on ZF 1.9 and there are over 100 occurrences.

Altruist answered 9/12, 2010 at 20:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.