Javascript – Embedded script languages for PHP

embedded-languagejavascriptPHPscripting

i was wondering if anybody knows of a nice scripting language that can be embedded into php?
Javascript would be favorite and although there are several attempts they are either much too shaky/slow/outdated (phpjs, j4p5) or a real pain to get up and running on shared hosts (pecl spidermonkey).

The background is: I would like to have a language that is used to control php on the server but it should also support some logic, so yaml, xml or json just isn't enough. I've looked into LUA interpreters and mediakwiki's "Winter" but they all either rely on external engines or have powerful binding whatsoever.

pecl spidermonkey binding's appears to be the most complete where you can register vars, functions and whole objects to the js-engine. Does anyone know of any system or language that might come close to what I am looking for?

best

rolf

Best Answer

I've not seens many engines that allow another scripting language to be enabled in PHP :-(
Even on PECL, there doesn't seem to be lots of entries (see the "languages" category, for instance : only one, which you already know)
And on PEAR, I don't even find anything that would match your criteria...

I've played with Spidermonkey a bit (see this article on my blog, in french), and it's kinda fun, yes. But it was not really stable a couple of months ago when I wrote that article -- and there have only been a few commits since. So, I understand why hosting companies would not provide it on their servers...
Even if I'd like them to : could be great to allow non-PHP developpers to develop scripts for your application !

A question though : why do you want/need another language than PHP ?

What I mean is PHP is already installed on your server, you obvisously have experience with it, and it's a quite powerful language... So why do you want/need to work with something else ?

Using PHP's eval, you can even think about executing "dynamic" PHP code (Yep, eval is eval and all that, I know ^^ )

Another option, using stuff like "exec" and the like would be, if you are on a Linux server, to launch some kind of shell-script ; but I would definitly prefer coding in PHP than shell, and I'm certainly not the only one ^^


Anyway, keeping an eye on the answers you might get, which could interest me quite a bit too ;-)