I've been reading https://frankenphp.dev/docs/extensions/ page and I am trying to build a PHP extension entirely in Go. So far, the type mapping for strings and integers works great.
However, I can't find a way to make a function throw a PHP Exception when something goes wrong in the Go logic.
If a Go function fails, I want to handle it with a standard PHP try/catch block:
try {
repeat_this('hello', -1);
} catch (Exception $e) {
echo "Caught: " . $e->getMessage(); // Should show the error from Go
}
Is there a way to trigger a PHP exception from within the Go function?
I've been reading https://frankenphp.dev/docs/extensions/ page and I am trying to build a PHP extension entirely in Go. So far, the type mapping for strings and integers works great.
However, I can't find a way to make a function throw a PHP Exception when something goes wrong in the Go logic.
If a Go function fails, I want to handle it with a standard PHP try/catch block:
Is there a way to trigger a PHP exception from within the Go function?