haXe/PHP

haXe/PHP is an extended version of the haXe compiler with a new platform target: PHP of course.

Why haXe/PHP? One of the biggest concerns in using haXe as a language for the server-side development is that you probably must install new software on the web-server (Apache mod_neko or some kind of JavaScript engine). This is not an option on many “cheap” (and not so cheap) hosting services while PHP is almost globally available.

Download

haXe/PHP v.1.19 CVS (2008-04-25) Alpha 2

The files contain a full haXe installation with the standard libraries modified to work with PHP. It does not contain Neko and the documentation.

Windows Installation

Unzip in a folder of choice and execute haxesetup.exe. To revert to the standard haXe installation, locate the original installation folder and execute the haxesetup.exe from there.

Mac OS X Installation

Run the downloaded installer and enjoy. This version also contains the documentation.

Source Code

The zip below contains the OCaml files needed to build haXe/PHP and its standard library.

haXe/PHP source code

SVN

You can grab the source code here: http://caffeine-hx.googlecode.com/svn/trunk/

Known Limitations

  • important parts of the std library to implement: SPOD, Remoting, haxe.Template
  • Input/Output will be not implemented because they will probably change a lot with haXe 2.0.
  • php.Web is still incomplete
  • String and Array are used as native values and are not encapsulated in objects. This makes the PHP code prettier and faster but as a drawback you can encounter inconveniences when those types are used as Dynamic (ex: Reflection).
  • resources are not implemented
  • function can't have the same name of the containing class (case insensitive). The problem is that PHP interprets that as a constructor.
  • Some constructs will not work properly:
    • a[b].c();
    • a.b()[c];
    • (new MyClass).execute();

Untested Features

  • Typedef extensions for Objects
  • Typedef extensions for Classes
  • a.b().c()
  • _ _resolve
  • _ _setfield
  • internal redefine function: f() { this.f = function() { }; return this.f();

To do list

High Priority

  • Std.string must output nicer values
  • check if properties with full accessors are created as var; if so, remove
  • build equivalent classes to the neko ones
  • test Reflection with Anonymous objects
  • _ _break_ _ is not used properly
  • break does not compile in while loops
  • Resolve the Known Limitations where possible
  • Fix bugs!

Optional

  • Debug version (similar to JS -debug) + haxe.Stack
  • better error handling
  • nicer PHP output (strip unnecessary {}, better indentation, docs ? …)
  • _ _set/_ _get/_ _call must be marked as reserved words when used in Dynamic
  • implementing autoload for class files

Discussion

Enter your comment (wiki syntax is allowed):