README 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. V8Js
  2. ====
  3. V8js is a PHP extension for Google's V8 Javascript engine
  4. Minimum requirements
  5. --------------------
  6. - V8 library version >= 3.17.11 <http://code.google.com/p/v8/> (trunk)
  7. - PHP 5.3.3+ (non-ZTS build preferred)
  8. Note: V8 engine is not natively thread safe and this extension
  9. has not been designed to work around it either yet and might or
  10. might not work properly with ZTS enabled PHP. :)
  11. API
  12. ===
  13. class V8Js
  14. {
  15. /* Constants */
  16. const string V8_VERSION;
  17. const int FLAG_NONE;
  18. const int FLAG_FORCE_ARRAY;
  19. /* Methods */
  20. // Initializes and starts V8 engine and Returns new V8Js object with it's own V8 context.
  21. public __construct ( [string object_name = "PHP" [, array variables = NULL [, array extensions = NULL [, bool report_uncaught_exceptions = TRUE]]] )
  22. // Compiles and executes script in object's context with optional identifier string.
  23. public mixed V8Js::executeString( string script [, string identifier [, int flags = V8Js::FLAG_NONE]])
  24. // Returns uncaught pending exception or null if there is no pending exception.
  25. public V8JsException V8Js::getPendingException( void )
  26. /** Static methods **/
  27. // Registers persistent context independent global Javascript extension.
  28. // NOTE! These extensions exist until PHP is shutdown and they need to be registered before V8 is initialized.
  29. // For best performance V8 is initialized only once per process thus this call has to be done before any V8Js objects are created!
  30. public static bool V8Js::registerExtension(string ext_name, string script [, array deps [, bool auto_enable = FALSE]])
  31. // Returns extensions successfully registered with V8Js::registerExtension().
  32. public static array V8Js::getExtensions( void )
  33. }
  34. final class V8JsException extends Exception
  35. {
  36. /* Properties */
  37. protected string JsFileName = NULL;
  38. protected int JsLineNumber = NULL;
  39. protected string JsSourceLine = NULL;
  40. protected string JsTrace = NULL;
  41. /* Methods */
  42. final public string getJsFileName( void )
  43. final public int getJsLineNumber( void )
  44. final public string getJsSourceLine( void )
  45. final public string getJsTrace( void )
  46. }