Zephir is a programming language for building PHP extensions. As in, the
.so files that extend the PHP language itself. Normally you need to use the C programming language to create a PHP extension, but Zephir is an intermediate language you can compile down to C code, (using the provided tooling). Its build system also automatically stitches everything together into a compilable/phpize-able extension. i.e. you say
and you have a working extension.
The docs are pretty good, although I ran into a few unmentioned gotchas while getting the hello world example up and running.
- You’ll need to install their PHP parse extension to get a working build system. (Zephir appears to use PHP itself as part of its build pipeline)
They don’t appear to officially support Mac OS, so I had to use hombrew to get a copy of
re2con my system.
Similarly, when I built the parser, my computer yelled at me:
./install: line 182: aclocal: command not found, but things seemed to compile without issue. I suspect there’s other rough edges related to Mac OS support
I am a derp
The idea of “modern” PHP extension development is a bit of an oxymoron, but Zephir’s is the best system I’ve found so far.