I know it's a bit late to respond to this, but...
Dealing with customizable user logic and not finding an easy, ready-to-go solution, was the exact reason why I just went ahead and created my own scripting language, called Primi.
Written purely in PHP, sandboxed in and interpreted by PHP. Done without dependencies on some external binaries and/or libraries, or any fancy, non-standard PHP extensions.
I mean, phpv8/v8js is pretty great (and looks like they've done a lot of work in the last 2 years), but the getting-it-to-work part was pretty rough for me - at least at the time, when I was doing my research about existing scripting solutions (and with my limited knowledge of Linux stuff back then). Downloading and compiling Google's V8, configuring a compiling the extension, and then finally getting it to work - that's not even an option sometimes, if you don't have absolute control over your machine (cloud hosting and stuff).
What can Primi do?
Primi most definitely is very, very inferior to any full-pledged scripting/programming language like PHP, JS, Python, etc. - both by features and by performance (it _is_ interpreted by PHP).
Primi's aim is not to do complex stuff - to have OOP, support classes, async stuff or whatnot (at least not right now) - but rather to provide a simple way for a developer to allow his/her clients to write custom logic (calculations, conditions, loops, string manipulations, etc.) that could be safely executed inside Primi's interpreter, which itself is executed by PHP and thus confined within PHP's own VM.
And all that without making any changes to the surrounding environment (OS-wide installing binaries, compiling libraries).
Installation
Primi can be installed as a Composer package and then used instantly:
composer require smuuf/primi
And that's it for the installation process.
Usage
The interpreter can be then used like this:
$context = new \Smuuf\Primi\Context;
$interpreter = new \Smuuf\Primi\Interpreter($context);
try {
// Let the interpreter run a source code.
$interpreter->run('a = 1; b = a + 2; c = "some string"; d = c + " extra thing";');
// Get defined variables from primary context and print them.
foreach ($context->getVariables() as $name => $value) {
printf("%s (%s) ... %s\n", $name, $value::TYPE, $value->getInternalValue());
}
} catch (\Smuuf\Primi\ErrorException $e) {
die($e->getMessage());
}
Running this code in PHP would result in this:
a (number) ... 1
b (number) ... 3
c (string) ... some string
d (string) ... some string extra thing
Disclaimer
I am the author of this
If you find any bugs to report, have suggestions for new features, or you just want to see how it works or want to help, you can find everything else here: https://github.com/smuuf/primi.