-
Notifications
You must be signed in to change notification settings - Fork 738
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
Interactive code examples on php.net #3259
Comments
wasm first would be a good idea as it would reduce the load as the input & results don't need to be stored and it is resistant to abuse - I agree it would probably cover most cases. It also matches the current setup of 3v4l with the "real-time" option checked by default. A separate endpoint on 3v4l would be needed that would accept the code and generate the correct output (via wasm) and include a "run on 3v4l" button. This would remove the needs to pre-store all examples on 3v4l and store the script-short code in the docs somewhere. |
There is already OSS project, which uses WebAssembly: Repository: https://github.com/seanmorris/php-wasm |
Many projects are doing that, e.g. https://github.com/WordPress/wordpress-playground. 3v4l.org also already implements that capability. See the Live preview checkbox in the right-bottom corner. Ideally, I envision being able to embed 3v4l.org snippets on the php.net page such that they initially appear static. Then, upon clicking, they load php-wasm behind the scenes, making the example editable. |
I have a POC ready - I went with iframes for the initial version. I implemented example of integration:
proposed change on the server side (not in production yet): SjonHortensius/3v4l_org@4137692 Additionally, I wouldn't mind documenting how to integrate the WASM binary from 3v4l directly - but the inline editing capabilities will have to be added by someone else. |
Regarding the 3v4l integration. How about having iframe-embeddings for code examples from 3v4l.org? We could, in theory, run a separate instance of it if needed, at 3v4l.php.net for example.
Another idea is to use WASM binary first, as it probably would cover 80% of cases.
So the user interaction might look like this:
In theory, both approaches could be used together. As in, all logic is implemented on 3v4l side, and loaded via iframe. In this case, such code examples could be used not only on php.net, but also on other PHP websites, blog posts, etc.
@SjonHortensius, @kamil-tekiela, @Girgias, what do you think?
The text was updated successfully, but these errors were encountered: