How to use available extensions (openssl) in PHP?

This is how I’m currently calling PHP’s native openssl_decrypt function:

var jsonString = Global.call_user_func(
  'openssl_decrypt', ct, 'aes-128-cbc', KEY, 1, IV

Specifically, I cannot access php.Global.OPENSSL_RAW_DATA or php.Global.openssl_decrypt
since these are not made available in the php.Global library.

The extension is loaded and available, and could easily be made a pre-requisite for PHP targets
by various means (require-dev/php-ext in composer for example).

I’m currently using Global.call_user_func, but wondering if there is a better way perhaps.

While haxe.Crypto nicely supports AES/128/CBC, it generates too much code for what a 3 line PHP snippet would do. So I’m sticking with haxe.crypto for harder targets, I’d like to use native crypto wherever possible.

php.Syntax is the way to go.

Something like:

var jsonString = Syntax.code("openssl_decrypt({0}, 'aes-128-cbc', {1}, 1, {2})", ct, KEY, IV);

That looks both scary and amazing.