1. Go to this page and download the library: Download suzunone/code-runner library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
suzunone / code-runner example snippets
.php
use Suzunone\CodeRunner\CodeRunner;
$source_code = 'console.log("Hello, world...");';
$CodeRunner = new CodeRunner;
$entity = $CodeRunner->create($source_code, CodeRunner::LANG_JAVASCRIPT);
while ($entity->is_running) {
$entity = $entity->status();
sleep(1);
}
var_dump($entity->details()->toArray());