-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If I did some significant work on this repo (touching almost every file), would you merge it? #147
Comments
@cweagans Considering the inactivity of this repository, I suggest forking it with your proposed changes. I am willing to volunteer to help implement the necessary changes if you would like, as I strongly believe that a WASM extension for PHP would be a valuable addition. |
Sounds like a plan, given the unmaintained state of this repository. To answer your questions from my outsider point of view:
I don't think wasm in PHP will be adopted if it is not being shipped in PHP's core. Yet I believe if this can get into PHP's core some day, it will boost the whole ecosystem. Not only for the obvious performance reasons, but imagine sharing logic between PHP+JS in frameworks like livewire: there would be no reason to rerender on the server anymore.
It won't be possible to write a pure PHP polyfill and you will need FFI if you want to provide a polyfill. Yet, It might beat the purpose though: you want to execute webassembly in a sandboxed environment, but run it in a fully opened up environment in which you create a sandbox instead. But sure, it is possible!
Shouldn't it be sufficient for an extension to provide a stub file? That way static analyzers know how it behaves.
You are right! The python wasmer bindings return primitive types as well instead of there wrapper values. It sure is possible! My point of view I think we both agree there is a lot of room for improvement in this inactive package.
I've been playing around with the wasmer rust bindings in combination with ext-php-rs (PHP bindings in rust) and set up a little POC: Sure it is full of shortcuts... The goal of the POC is to see if it was possible to:
How to go forward I'm not sure... I see a couple of routes:
In any case, I am also convinced we should be able to run wasm in PHP! |
Hey @veewee, Thanks for your input on the WASM extension for PHP repository. Your feedback is much appreciated! I agree that Rust would be a great choice for this project and could potentially improve its functionality or at least make our lives easier. I'm also wondering if it might be a good idea to start a new repository or organization for this project, as the current one looks a bit stale. By the way, I noticed that https://github.com/veewee/ext-wasm appears to be a private repository, so I wasn't able to take a closer look. Thanks again for your help and insight! Looking forward to collaborating further. |
Thanks for noticing, it should be public now. I don't know what php internal's view on using rust or even wasm is nowadays. Not sure if that unknown is something we should use to base the technology upon though. |
IMO, take this one step at a time: get the extension working for a large number of people first. If the PHP code can use an extension or FFI to handle loading and running the WASM blob, then it'll work on pretty much any host (IIRC, FFI is enabled by default in PHP 7.4 and above). Just so that nobody is waiting on me: I probably will not work on this. |
No problem @cweagans . I'm going to play a bit more with the rust bindings anyways, step by step. |
I would like to rework this repository into something more widely usable in the PHP community. Here are a few things that I've noticed:
resource
in PHP, it's impossible to write a pure PHP polyfill that would e.g. use FFI or similar to get the same functionality. It's not possible to create a new resource type directly in PHP and it is also not possible to pretend that an object is an instance of a particular resource type, so even if I write a class that has the same interface as your resource, I still can't pass it in as an argument to the constructor of e.g.\Wasm\Module
. There are a couple of libraries that I'm aware of that rely on an extension, but have a pure PHP implementation as a fallback -- even if that's just via FFI. FFI is a relatively new thing to PHP, but I think it's still a viable path for people using PHP 7.4 or higher.final
, I also can't extend the class and make the changes that I need to make in order to support the above on my own.This would more or less be a 2.x version of this library (I'm not sure how you'd do this without a BC break). Maybe it's of interest?
The text was updated successfully, but these errors were encountered: