phpv8 / php-v8

PHP extension for V8 JavaScript engine
https://php-v8.readthedocs.io
MIT License
217 stars 14 forks source link

what is the difference #113

Closed juan-morales closed 5 years ago

juan-morales commented 5 years ago

I am new to this and this may be an obvious point to most of you but ....

What is the difference between php-v8 (this) and v8js ?

pinepain commented 5 years ago

php-v8 author is here.

In short, php-v8 is more an interface to v8 while v8js is more end-user friendly solution. One could implement v8js with php-v8. If you simply need to run some scripts and get output without advanced logic, v8js is a good choice. AFAR, it also supports variables and functions passing, so in vast majority cases it is a good start (I started with it myself). If you need to make fancy things - give php-v8 a try. If you decide to, give js-sandbox a look, it's a high-level abstraction on top of php-v8.

Both php-v8 and js-sandbox were my experiments to bring js into PHP instead of writing own DSL for the sandboxed arbitrary code execution. The use case I had was to expose some API to users and let them script some things in system.

juan-morales commented 5 years ago

Thanks very much for the quick reply. I will give it a try .