PHP usually provides extensions; like pcntl, hprose, sockets and alike.
In order to reproduce these within Uniter, this is what I would suggest:
var Extension = require("uniter-extension");
var cURL = new Extension();
cURL.function("curl_init", function(){
// Implement curl_init
});
function cURLClass(args) {}
// a cURL class
}
cURL.addClass("cURL", cURLClass);
module.exports = cURL;
Now, we could extend Uniter by an additional function. Currently, we have .install() to install functions, constants and classes into the system. As far as I remember, they all go into global scope. Extensions could be registered similarily:
var rt = require("phpruntime");
rt.registerExtension( "curl", require("./myCurlExt.js") );
rt.loadExtension("curl");
This would also provide the extension_loaded function to Uniter. Also, we might be able to use dl().
To summarize:
Add Extension support to Uniter, so that native PHP extensions can be emulated.
Let the runtime know about Extensions. The user should be able to add, remove, enable and disable extensions.
Uniter PHP scripts should be able to use:
extension_loaded($extName)
dl($extName)
Implementation is up to you, the above are just pseudo-code examples :) But i bet you get what I meant.
PHP usually provides extensions; like pcntl, hprose, sockets and alike.
In order to reproduce these within Uniter, this is what I would suggest:
Now, we could extend Uniter by an additional function. Currently, we have
.install()
to install functions, constants and classes into the system. As far as I remember, they all go into global scope. Extensions could be registered similarily:This would also provide the
extension_loaded
function to Uniter. Also, we might be able to usedl()
.To summarize:
Extension
support to Uniter, so that native PHP extensions can be emulated.extension_loaded($extName)
dl($extName)
Implementation is up to you, the above are just pseudo-code examples :) But i bet you get what I meant.