Documentation
¶
Overview ¶
Package stdlib provides the forwarded "bring your own standard library" shims (the README's register_function mechanism). PHP's stdlib is not reimplemented in the VM; instead a curated set of Go functions is registered on a Runtime so transpiled PHP can call them by name. This set is sized to run the minitpl template engine (the T1 compatibility target).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register installs the pure (non-filesystem) shims and PHP constants. Use RegisterFS to add filesystem IO bound to a root directory.
func RegisterFS ¶
RegisterFS installs filesystem IO shims rooted at dir. Reads and writes are confined to that directory tree, mirroring how the upstream engine runs inside its project checkout. Paths from PHP are treated as relative to dir.
Go's fs.FS is read-only, so the engine's writes (fopen/fwrite/mkdir) use the os package against the same root; the runner's include resolution still uses the fs.FS abstraction passed to runner.New.
Types ¶
type Exception ¶ added in v0.0.3
Exception holds an error code and error message.
func NewException ¶ added in v0.0.3
NewException will return a new allocation for an exception. A nil error is returned so a new exception is not thrown immediately whenever a `new Exception` call is made in the runtime.
func (Exception) GetMessage ¶ added in v0.0.3
GetMessage returns the error message of the exception.