phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.84k stars 200 forks source link

Provide experimental access to V8's Inspector API #445

Open stesie opened 4 years ago

stesie commented 4 years ago

This PR allows low-level access to V8's Inspector API, primarily to get call count/coverage data from it.

Theoretically it's possible to connect to V8's debugger this way. However I suppose this would cause problems, if you set a breakpoint in your JavaScript code, since that would block PHP code execution also. So I'd assume, in order to allow proper access to the debugger, further changes will be needed.

Also this only allows for programatic access to the inspector backend, i.e. it does not allow out-of-the-box connections from Chrome DevTools via websockets. However it should now be possible to implement a websocket server in PHP, that bridges messages with the V8Inspector instance (and then connect Chrome DevTools to that one).

A simple example regarding programatic access is shown in the README file