chore: remove runtime target, work on php release

This commit is contained in:
Steve Manuel
2022-09-01 22:07:28 -06:00
parent 10235514dc
commit 63ff9da8dc
8 changed files with 235 additions and 43 deletions

View File

@@ -19,7 +19,7 @@ jobs:
target: [
aarch64-unknown-linux-gnu,
aarch64-unknown-linux-musl,
i686-unknown-linux-gnu,
# i686-unknown-linux-gnu,
x86_64-unknown-linux-gnu ]
if: always()
steps:

View File

@@ -2,7 +2,7 @@
"name": "extism/extism",
"description": "Make your software programmable. Run WebAssembly extensions in your app using the first off-the-shelf, universal plug-in system.",
"license": "BSD-3-Clause",
"type": "project",
"type": "library",
"keywords": [
"WebAssembly",
"plugin-system",
@@ -30,7 +30,7 @@
"prefer-stable": true,
"autoload": {
"psr-4": {
"Extism\\Plugin\\": "php/src/"
"Extism\\": "php/src/"
}
},
"autoload-dev": {

View File

@@ -1,9 +1,9 @@
<?php
require("Plugin.php");
require_once "vendor/autoload.php";
$wasm = file_get_contents("../wasm/code.wasm");
$plugin = new Plugin($wasm);
$wasm = file_get_contents("../../wasm/code.wasm");
$plugin = new \Extism\Plugin($wasm);
$output = $plugin->call("count_vowels", "this is an example");
$json = json_decode(pack('C*', ...$output));

View File

@@ -2,16 +2,15 @@
"name": "extism/example",
"description": "Example running the Extism PHP Host SDK",
"license": "BSD-3-Clause",
"autoload": {
"psr-4": {
"Extism\\Example\\": "src/"
}
},
"type": "project",
"authors": [
{
"name": "The Extism Authors",
"email": "oss@extism.org"
}
],
"require": {}
"require": {
"extism/extism": "dev-pre-release"
},
"minimum-stability": "dev"
}

215
php/example/composer.lock generated Normal file
View File

@@ -0,0 +1,215 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "09e1d63dd98909eb15b01510f7b80a80",
"packages": [
{
"name": "extism/extism",
"version": "dev-pre-release",
"source": {
"type": "git",
"url": "https://github.com/extism/extism.git",
"reference": "bddfc825137de3571d172d0cfc51262e36b418be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/extism/extism/zipball/bddfc825137de3571d172d0cfc51262e36b418be",
"reference": "bddfc825137de3571d172d0cfc51262e36b418be",
"shasum": ""
},
"require": {
"ircmaxell/ffime": "dev-master",
"php": "^7.4 || ^8"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
"Extism\\": "php/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "The Extism Authors",
"email": "oss@extism.org",
"homepage": "https://extism.org"
},
{
"name": "Dylibso, Inc.",
"email": "oss@dylib.so",
"homepage": "https://dylib.so"
}
],
"description": "Make your software programmable. Run WebAssembly extensions in your app using the first off-the-shelf, universal plug-in system.",
"keywords": [
"plug-in",
"plugin-system",
"runtime",
"webassembly"
],
"support": {
"issues": "https://github.com/extism/extism/issues",
"source": "https://github.com/extism/extism/tree/pre-release"
},
"time": "2022-09-02T04:11:11+00:00"
},
{
"name": "ircmaxell/ffime",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/ircmaxell/FFIMe.git",
"reference": "5f648f95ecf23262a2e58f4e4c9001bd1b5f9c98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ircmaxell/FFIMe/zipball/5f648f95ecf23262a2e58f4e4c9001bd1b5f9c98",
"reference": "5f648f95ecf23262a2e58f4e4c9001bd1b5f9c98",
"shasum": ""
},
"require": {
"ircmaxell/php-c-parser": "dev-master",
"ircmaxell/php-object-symbolresolver": "dev-master",
"php": ">=8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
"FFIMe\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anthony Ferrara",
"email": "ircmaxell@gmail.com"
}
],
"description": "Make life easy when working with 7.4's FFI",
"support": {
"issues": "https://github.com/ircmaxell/FFIMe/issues",
"source": "https://github.com/ircmaxell/FFIMe/tree/master"
},
"time": "2022-09-01T18:56:19+00:00"
},
{
"name": "ircmaxell/php-c-parser",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/ircmaxell/php-c-parser.git",
"reference": "55e0a4fdf88d6e955d928860e1e107a68492c1cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ircmaxell/php-c-parser/zipball/55e0a4fdf88d6e955d928860e1e107a68492c1cf",
"reference": "55e0a4fdf88d6e955d928860e1e107a68492c1cf",
"shasum": ""
},
"require": {
"php": ">=7.4"
},
"require-dev": {
"ircmaxell/php-yacc": "dev-master",
"phpunit/phpunit": "^8.0"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
"PHPCParser\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anthony Ferrara",
"email": "ircmaxell@gmail.com"
},
{
"name": "Bob Weinand",
"email": "bobwei9@hotmail.com"
}
],
"description": "Parse C when using PHP",
"support": {
"issues": "https://github.com/ircmaxell/php-c-parser/issues",
"source": "https://github.com/ircmaxell/php-c-parser/tree/master"
},
"time": "2022-08-27T17:37:14+00:00"
},
{
"name": "ircmaxell/php-object-symbolresolver",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/ircmaxell/php-object-symbolresolver.git",
"reference": "3734df2b22d7c8273ee6f6f2155fddde6056d057"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ircmaxell/php-object-symbolresolver/zipball/3734df2b22d7c8273ee6f6f2155fddde6056d057",
"reference": "3734df2b22d7c8273ee6f6f2155fddde6056d057",
"shasum": ""
},
"require": {
"php": ">=7.4"
},
"default-branch": true,
"type": "library",
"autoload": {
"psr-4": {
"PHPObjectSymbolResolver\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anthony Ferrara",
"email": "ircmaxell@gmail.com"
},
{
"name": "Bob Weinand",
"email": "bobwei9@hotmail.com"
}
],
"description": "An object file (ELF, Mach-O) parser",
"support": {
"issues": "https://github.com/ircmaxell/php-object-symbolresolver/issues",
"source": "https://github.com/ircmaxell/php-object-symbolresolver/tree/master"
},
"time": "2022-08-14T19:30:20+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"extism/extism": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.3.0"
}

View File

@@ -1,19 +0,0 @@
Copyright (c) 2019-2022 Ben Ramsey <ben@benramsey.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,11 +1,15 @@
<?php
declare(strict_types=1);
namespace Extism;
require_once "vendor/autoload.php";
require_once "generate.php";
require_once "Extism.php";
require_once "ExtismLib.php";
$lib = new Extism(Extism::SOFILE);
$lib = new \ExtismLib(\ExtismLib::SOFILE);
if ($lib == null) {
throw new Exception("Extism: failed to create new runtime instance");
}
class Plugin
{
@@ -85,11 +89,4 @@ function string_to_bytes($string) {
}
return $bytes;
}
// $wasm = file_get_contents("/Users/stevemanuel/Projects/extism/extism/wasm/code.wasm");
// $plugin = new Plugin($wasm);
// $output = $plugin->call("count_vowels", "this is a test");
// $json = json_decode(pack('C*', ...$output));
// echo "Vowels counted = " . $json->{'count'} . PHP_EOL;
}

View File

@@ -9,7 +9,7 @@ function generate($paths) {
$ffi = (new FFIMe\FFIMe("libextism.".soext()))
->include("extism.h")
->showWarnings(false)
->codeGen('Extism', 'Extism.php');
->codeGen('ExtismLib', __DIR__.'/ExtismLib.php');
} catch (Exception $e) {
continue;
}
@@ -30,7 +30,7 @@ function soext() {
}
}
if (!file_exists("Extism.php")) {
if (!file_exists(__DIR__."/ExtismLib.php")) {
generate($search_path);
}