Use go:embed embed.FS rather than tar + exporting files to a temp directory? #1178
Replies: 2 comments 1 reply
-
|
This would need support in PHP itself (particularly the require/include/require_once/include_once directives) as well as a custom stream filter to intercept local files -- it would be similar to the |
Beta Was this translation helpful? Give feedback.
-
|
Hi, i just stumbled across this whilst checking if FrankenPHP supports the Caddy builtin filesystem directives: it seems like not currenty based on the response. if this work one could use such cursed caddy filesystem backends as https://github.com/mohammed90/caddy-git-fs for serving php |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've made this a discussion rather than issue, as I'm not sure if it is valid or not.
I was just exploring how FrankenPHP does the embedded builds, and it looks like
build-static.shscript which creates a tar of the application which gets embeddedI wonder if the whole process could be simplified if you use the embed.FS which "implements fs.FS, so it can be used with any package that understands file system interfaces, including net/http, text/template, and html/template."?
Moreover, it might even be higher performance since the files would be read from within the binary rather than the temp directory. Furthermore, I could see this being useful in the sense of wanting to protect Intellectual Property by not extracting php files. I dont know if this would result in extra/excessive ram usage though, as compared to the tar extraction.
I also wonder if it could perhaps even somehow be pre-compiled into the opcache?
Beta Was this translation helpful? Give feedback.
All reactions