

Validate Superglobals: - Default Value: true.If this flag isĭisabled then all global validation, including custom global validation, will be ignored. If this flag is set the sandbox will validate globals within the sandboxed code. Validate Globals: - Default Value: true.If this flag isĭisabled then all variable validation, including custom variable validation, will be ignored. If this flag is set the sandbox will validate variables within the sandboxed code. Validate Variables: - Default Value: true.If this flag isĭisabled then all function validation, including custom function validation, will be ignored. If this flag is set the sandbox will validate functions within the sandboxed code.


Validate Functions: - Default Value: true.Example: $sandbox->setOption('allow_functions', false) Option Descriptions $sandbox->allow_functions = true ) or through the setOption()Īnd setOptions() instance methods. The flag's public instance property (e.g. Options are configured in the PHPSandbox class by accessing You have four main areas of configuration available in PHPSandbox: Options, $traits) $sandbox = \PHPSandbox\PHPSandbox::create($options,Ĭlick the "Configuring PHPSandbox" tab below to continue. $traits - This is equivalent to using the defineTraits() method.Įxamples: $sandbox = new \PHPSandbox\PHPSandbox($options,.$interfaces - This is equivalent to using the defineInterfaces() method.$classes - This is equivalent to using the defineClasses() method.$magic_constants - This is equivalent to using the defineMagicConsts() method.$superglobals - This is equivalent to using the defineSuperglobals() method.$aliases - This is equivalent to using the defineAliases() method.$namespaces - This is equivalent to using the defineNamespaces() method.$constants - This is equivalent to using the defineConsts() method.$variables - This is equivalent to using the defineVars() method.$functions - This is equivalent to using the defineFuncs() method.$options - This is equivalent to using the setOptions() method.You can pass the following array arguments to either method to setup the sandbox: You have two methods of instantiating a PHPSandbox instance: the new keyword, or the static method PHPSandbox::create() New Keyword $sandbox = new \PHPSandbox\PHPSandbox() Static Method $sandbox = \PHPSandbox\PHPSandbox::create() Otherwise, you must include all PHPSandbox files and If you have a PSR-0 compliant autoloader, simply put the PHPSandbox folder under /src in your library folderĪnd it will handle loading all PHPSandbox files for you. PHPSandbox classes is: require_once('vendor/autoload.php') If you have downloaded PHPSandbox through composer, then the only thing you need to do to include all required
