Welcome to php-v8’s documentation!¶
About¶
php-v8 is a PHP 7.x extension that brings V8 JavaScript engine API to PHP with some abstraction in mind and provides an accurate native V8 C++ API implementation available from PHP.
Hello, world!¶
<?php
use V8\{Isolate, Context, StringValue, Script};
$script = "'Hello' + ', World!'";
$isolate = new Isolate();
$context = new Context($isolate);
echo (new Script($context, new StringValue($isolate, $script)))
->run($context)
->value(), PHP_EOL;