Skynet offers remote PHP code execution functionality. It's based on PHP's eval() function.
If you need to execute PHP code sended via request on remote cluster(s) just use:
- @eval
Command takes one parameter: php with code source.
Example:
If you want to execute code below on another cluster and takes result:
- <?php return 2+2; ?>
you need to do this like these:
- @eval php:"return 2+2;";
or in Event Listener:
/src/SkynetUser/MyListener.php
- public function onRequest($context)
- {
- if($context == "beforeSend")
- {
- $code = 'return 2 + 2;';
- $this->request->set('@eval', array('php' => $code));
- }
- }
Skynet will send request, remotely execute PHP code and returns output in response field:
- @<<eval
In example above output will be:
- @<<eval = 4