This is a short example of xhp-js, using Composer and npm. The following are demonstrated:
XHPJS::Instance()
XHPJS::Element()
jsCall()
constructJSInstance()
constructReactInstance()
Recent versions of:
- HHVM
- NodeJS
- NPM
$ wget https://getcomposer.org/composer.phar
$ hhvm composer.phar install
This will also execute npm install
and npm run build
; take a look at
package.json
and composer.json
for details. In short, it installs:
- xhp-js (
vendor/
,node_modules/
) - xhp-lib (
vendor/
) - React (
node_modules/
) - Browserify (
node_modules/
)
It also builds a bundle.js combining the external dependencies with the example Javascript.
Configure your webserver to serve this directory via HHVM+FastCGI, or, alternatively:
$ hhvm -m server -d hhvm.server.type=proxygen -p 8080
Then open http://localhost:8080/example.php in your web browser.
Configure your webserve to serve this directory via HHVM+FastCGI. Documentation is available here: