frankenphp
frankenphp copied to clipboard
extgen: Add support for init/minit/mshutdown
This PR adjusts extgen to handle:
- the case where the go code already contains an
init()function. - support for
//export_php:module initto handle resource creation during module startup - support for
//export_php:module shutdownto handle resource cleanup during module shutdown
My last commit breaks classes, but is needed for functions-only extensions. I'll need to make that import conditional on whether or not there are classes present and add a test for it.
This one is probably ready for review now @dunglas
This is really nice and certainly useful. Thanks!
Bikeshedding: should we call the directives //export_php:minit and mshutdown to match PHP's macros? Your proposition also suits me fine. It's just to see if someone would prefer this 🙂