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

Access public - Methods in child class #183

Closed kinimodmeyer closed 8 years ago

kinimodmeyer commented 8 years ago

hello guys, i created a child class to add more functionality to V8Js (dont know if this is right).

class test extends V8Js
{
    public function hello()
    {
        die('hello world');
    }
}

now i want to access this method in my js code with

PHP.hello();

but i just get the following error:

TypeError: undefined is not a function

with properties it works like expected:

class test extends V8Js
{
    public $hello = 'hello world';
}
PHP.hello;

i hope you can help me with this.

stesie commented 8 years ago

TODOs for PHP 5.x

I consider __get, __set, __call, __invoke et al beyond the scope of this ticket, and actually tend to not implement them. All that stuff already works with normal object export and probably will be pretty easy once #72 lands finally (in V8Js 2.0.0 or so).