ScriptLite is a sandboxed ECMAScript (ES5/ES6 subset) interpreter written in PHP, designed to safely embed user-provided scripts in PHP applications. It supports three execution backends: a native C extension (~178x faster than the PHP VM), a PHP bytecode VM with 62 opcodes, and a PHP transpiler that leverages OPcache/JIT (~40x faster than the PHP VM). Use cases include user-defined formulas, configuration logic, data transformation, computed fields, and workflow rules. Scripts run in a sealed environment with no filesystem, network, or PHP internals access. PHP interop allows passing scalars, arrays, closures, and PHP objects into scripts, with automatic type conversion on return. The library includes LRU caching at every pipeline stage and ships with 907 tests across all three backends.

1 Comment

Sort: