V8 JavaScript engine API for PHP

This extension brings V8 JavaScript engine API to PHP with some abstraction in mind and provides an accurate native V8 C++ API implementation available from PHP.

License: The MIT License (MIT)

Latest releases

Version Release Download
0.2.2 2018-02-27 v8-0.2.2.tgz
0.2.1 2017-10-23 v8-0.2.1.tgz
0.2.0 2017-09-30 v8-0.2.0.tgz
0.1.9 2017-09-01 v8-0.1.9.tgz
0.1.8 2017-07-17 v8-0.1.8.tgz
Show all releases


Version Message
0.2.2 I'm excited to announce that starting from this release documentation is available at

Read The Docs is awesome place to host documentation and Sphinx would help to create decent documentation.
Contributors welcomed!

This is the last version that supports PHP 7.1. Nex versions wil reqiure PHP >= 7.2 unless further notice.

BC-breaking changes:

- Upgrade v8 version to 6.6.313
- Remove deprecated and non-working ScriptCompiler cache options
- Rework PromiseObject
- Add ValueObject::isBigInt64Array() and ValueObject::isBigUint64Array methods

Non-breaking changes:

- Add number of native and detached contexts to HeapStatistics
- Add support to produce code cache
- Add ScriptCompiler::OPTION_EAGER_COMPILE option
- Add support for integer- - Add {Template,ObjectValue}:setLazyDataProperty() method
0.2.1 This release brings stability and improvements. It contains some minor BC-breaking changes which should not affect general public. See full change log below for details


BC-breaking changes:

- require libv8 >= 6.4.6;
- remove UnboundScript::kNoScriptId const and return null in getId() on no data
- change ScriptCompiler::cachedDataVersionTag(): int method name and return type to be ScriptCompiler::getCachedDataVersionTag(): float;
- remove StartupData::getRawSize() method;

Non-breaking changes:

- fix segfault when invalid startup data passed to isolate;
- fix external exception lost when it has refcount 1;
- change script compiler version tag generation to take into account changes to extension internals;
- add CallbackInfoInterface;
- add support for ScriptCompiler::kProduceFullCodeCache;
- add {Isolate,Context}::within() as optimization solution;
- add StartupData::isRejected();
- add docs skeleton.
0.2.0 This release introduces many major changes to public API and breaks BC for the sake of more solid and stable API in a further versions.

Maintaining this project takes significant amount of time and efforts.
If you like my work and want to show your appreciation, please consider supporting me: https://www.patreon.com/pinepain


- Drop PHP 7.0 support, #30;
- Add typehint for $value param in Template::set(), #36;
- Rename constants to match PSR-2 convention, #34;
- Make enum classes with constants final, #39 ;
- Rename HeapStatistics methods to match PSR-2, #38;
- Rename V8\Exception class and it methods, #33;
- Add FunctionObject::getScriptId() method;
- Remove no-data constants and use NULL instead, #40;
- Refactor ScriptOriginOptions to use bit field, #42;
- Remove redundant ScriptOrigin::is*() methods, #61;
- Add missed method to Value stub;
- Fix improperly adjusted external allocated memory on weak callback call;
- Add Proxy and Promise builtin support, #55;
- Add support for regexp dotAll flag, #54;
- Move RegExpObject\Flags constants under RegExpObject, #64;
- Move CompileOptions constants under ScriptCompiler, #65;
- Add Isolate::MemoryPressureNotification() support, #57;
- Require libv8 >= 6.3.163;
- Add StackFrame::isWasm(), #53;
- Get rid of CallbackInfo, #67;
- Add immutable prototype chains to ObjectTemplate, #58;
- Add StartupData::warmUpSnapshotDataBlob(), #59;
- Add missed JSON class support, #56;
- Add Message::getErrorLevel() method, #52;
- Rename SymbolValue methods, #41;
- Rename TryCatch methods, #41;
- Add missed PrimitiveValue::value() abstract method;
- Add Isolate::SetRAILMode(), #60;
- Fix improperly internally constructed RAILMode enum class, #60.

See https://github.com/pinepain/php-v8/issues/43#issuecomment-333329225 for details
0.1.9 Refactor methods name to follow PSR-2 camelCase convention.

NOTE: This is the last release that supports PHP 7.0.

Changes list:
- refactor methods name to follow PSR-2 camelCase convention;
0.1.8 This release extends and clarify existent API and does not introduce any BC-breaking changes.

Changes list:

- Change V8\Exception::*Error() return type to V8\ObjectValue as the only possible type;
- Add external exception wiring option to V8\Isolate::ThrowException().
Show complete changelog