After reading your comment, I gave Haxe another look. Actually, I don't remember why I didn't use it in the first place. I'll perhaps give it a go.
It's worth a try! If you're looking for a good editing environment for it, There's a good VS Code Haxe extension that works well - it has code completion and a few other nice features.
And if you're ever unhappy with the language and want to jump in and wrangle the syntax tree yourself, it has a decent macro system.
The bits of code that talk to native PHP functions will be platform specific, but I've been building up a little library of utilities that work with Haxe's other compilation targets - mainly JS, C++, Python, and C# for me. I've been especially impressed with its Javascript generation - it emits very readable and understandable JS, and its dead code elimination is quite smart; if you import a library and only use one method from one class, that's all you'll get in your compiled code.