Coder Social home page Coder Social logo

v8's Introduction

php extension for Google's v8 javascript engine 

Requires php 5.3+ and libv8 <http://code.google.com/p/v8/>

-Highly experimental-


NOTES
-----

The v8 javascript engine is not natively thread safe. 
This extension does not work around it (at least for now).
Please use a single threaded sapi (CLI, fastcgi, fpm..)


INTERFACE
---------

The extension interface has been refactored to make it more similar
to the spidermonkey PECL extension <http://pecl.php.net/package/spidermonkey>

class V8Context {

  // php types for V8Context::set()
  const PHP_VALUE   = 0;
  const PHP_FUNCTION= 1;
  const PHP_CLASS   = 2;

  bool  function set($var_name, $value [, $type = V8Context::PHP_VALUE]);

  mixed function get($var_name);

  bool  function exists($var_name);

  bool  function unset($var_name);

  // evals the js code and returns the result
  mixed function run($js_code);

  // same as set($js_name, $callable, V8Context::PHP_FUNCTION)
  bool registerFunction($callable [, $js_name]);

  // same as set($js_name, $class_name, V8Context::PHP_CLASS)
  bool registerClass($class_name [, $js_name]);
}


INSTALLATION
------------

phpize and php-config must be in your PATH.
If not, please specify their full path in the following commands.

$ cd /path/to/this/extension/v8

$ phpize
(or /path/to/phpize if phpize is not in your path)

$ ./configure --with-v8=/path/to/google/v8
(or ./configure --with-php-config=/path/to/php-config 
if php-config is not in your path)

$ make

$ cp modules/v8.so /to/wherever/you/want/it

Add the following line to php.ini:
extension="/wherever/you/put/it/v8.so"

Restart your webserver

v8's People

Contributors

metagoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.