Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork23
-
I did some exploration to get the Phel classes loading from Composer installation and Phel evaluation of working from JavaScript withhttps://github.com/seanmorris/php-wasm. Copying Composer files to Emscripten filesystem is bit of a hurdle but afterwards I figured out following custom Phel initialization in PHP script that publishes # This is the WASM PHP entrypointrequire_once'/vendor/autoload.php';try {Gacela\Framework\Gacela::bootstrap("/", \Phel\Phel::configFn());$runFacade =newPhel\Run\RunFacade();$srcDirectories =$runFacade->getAllPhelDirectories();$namespaceInformation =$runFacade->getDependenciesForNamespace($srcDirectories, ['phel\\core']);// Suppress deprecation warnings from evalFileerror_reporting(E_ALL ^E_DEPRECATED);// ^ E_NOTICE// Deprecated: Implicit conversion from float 4294967295 to int loses precision in /vendor/phel-lang/phel-lang/src/php/Compiler/Domain/Emitter/OutputEmitter/SourceMap/VLQ.php on line 158foreach ($namespaceInformationas$info) {$runFacade->evalFile($info); }$compilerOpts =newPhel\Compiler\Infrastructure\CompileOptions();functionphelEval($phelCode){global$runFacade,$compilerOpts;$runFacade->eval($phelCode,$compilerOpts);}phelEval('(let [a 4] (println "Phel calculation is " (+ 96 a)))');phelEval('(println "YAY")');}catch (\Exception$e) {echo"Error using Phel:" .$e->getMessage() ."\n";} Example code with some more contexthttps://git.sr.ht/~jasalt/php-wasm-testing/tree/master/item/composer-autoload-phel. Looking possibly to make something useful with this like a REPL for Phel docs when I have time but thought to share this snippet here for now if somebody finds use for it. linux_desktop_recording-2025-05-30_14.40.25.mp4 |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2😄 1🎉 1
Replies: 1 comment
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
@jasalt after 0.17, Gacela will be totally hidden from Phel (code) - Gacela\Framework\Gacela::bootstrap("/", \Phel\Phel::configFn());+ \Phel\Phel::bootstrap("/"); |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1