# php2vala Embed zval bindings

## Rule

The embed runtime should provide broad PHP function coverage through named `*_zval` wrappers.

For regular PHP functions that are reachable through libphp `call_user_function()`, the runtime should expose a named wrapper such as `PhpEmbed.md5_zval(...)` or `PhpEmbed.strtoupper_zval(...)`.

php2vala must dynamically inspect the loaded `.vapi` files and may emit a direct `PhpEmbed.<function>_zval(...)` call only when that wrapper is present. If no wrapper exists, the function stays unsupported.

Do not emit stringly generic generated calls such as `PhpEmbed.call_zval_params("function_name", ...)`. The generic call helper can exist inside the runtime, but generated user code should use named wrappers so manual Vala users and php2vala see the same public ABI.

This gives us correct PHP semantics first. Optimized `*_static` variants can be added later for hot functions.

## What stays special

Do not route PHP language constructs through the generic function fallback:

- `echo`
- `isset`
- `empty`
- `exit`
- `die`
- future include/require-style constructs

These are not normal callable PHP functions and need dedicated lowering/runtime handling.

## Static ABI relationship

The named fallback is explicitly a `*_zval` path.

`*_static` remains a separate optimizer ABI:

- native Vala parameters and native Vala return values
- always implemented through libphp/Zend
- no `Php.zval` construction or passing in the Vala static call path

See `../../a_vala_libs/valaphp-runtime-embed/STATIC_ABI_RULES.md`.
