

Php sandbox code#

Can prepend and append trusted code to setup and tear down the sandbox, and automatically whitelist the classes, functions, variables, etc.

Can selectively allow and disallow function creation, class declarations, constant definitions, keywords, and much more.Can overwrite the get defined and get declared functions to show only allowed functions, classes, etc.Can redefine superglobals and magic constants to expose your own values to sandboxed code.Can redefine internal PHP and other functions to make them more secure for sandbox usage.Includes dynamic demonstration system that allows for local testing of custom sandbox configurations.Finegrained whitelisting and blacklisting, with sensible defaults configured.It also utilizes FunctionParser to disassemble callables passed to the sandbox, so that PHP callables can also be run in sandboxes without first converting them into strings. A full-scale PHP 7.4+ sandbox class that utilizes PHP-Parser to prevent sandboxed code from running unsafe code.
