Compare commits

...

1 Commits

Author SHA1 Message Date
Benjamin Eckel
a4eb1da47b fix(php-sdk): fix exception spelling 2022-11-28 19:23:08 -06:00

29
php/src/generate.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
require_once "vendor/autoload.php";
function generate() {
return (new FFIMe\FFIMe("libextism.".soext()))
->include("extism.h")
->showWarnings(false)
->codeGen('ExtismLib', __DIR__.'/ExtismLib.php');
}
function soext() {
$platform = php_uname("s");
switch ($platform) {
case "Darwin":
return "dylib";
case "Linux":
return "so";
case "Windows":
return "dll";
default:
throw new Exception("Extism: unsupported platform ".$platform);
}
}
if (!file_exists(__DIR__."/ExtismLib.php")) {
generate();
}