Search code examples
phphiphop

Using PHP HipHop to create modular helpers


From what I've read about PHP HipHop – it serves the purpose of converting PHP code into C++. The bit I did not understand is how the actual code is later on executed and whether only some elements of code can be HipHop'ed.

I have files helpers.inc.php (contains a lot of functions), database.class.inc.php (contains PDO extension) and similar that don't change often. I'd like to convert them into C++ PHP module that I could include to other project files or simply make them available across the system.

Is that possible using PHP HipHop?


Solution

  • You've been misled and should read the Running HipHop wiki page:

    You can run HipHop in 5 different modes.

    Mode 1: Compiling HipHop and running it directly.

    Mode 2: Compiling HipHop in a temporary directory and running the compiled program from the command line.

    Mode 3: Compiling HipHop in a temporary directory and running the compiled program as a web server.

    Mode 4: Interpreting HipHop directly.

    Mode 5: Starting a Web server or daemon and interpreting HipHop on the fly.

    If you want to create extensions, you should dive into the documentation: http://www.php.net/manual/en/internals2.php

    But mostly, YAGNI.