A small, working, reusable template for calling Nim code from PHP
https://github.com/lucianofedericopereira/nlftp/tree/main/php-ext
FFI (Foreign Function Interface) lets PHP call functions in a precompiled shared library directly, by declaring their C signatures — no C extension to write, no recompile per PHP version. PHP's ext-ffi does the dlopen, looks up each symbol, and converts arguments to/from C types at the call site.