PHP code example of lifespikes / php-node
1. Go to this page and download the library: Download lifespikes/php-node 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/ */
lifespikes / php-node example snippets
namespace LifeSpikes\PHPNode\Engine;
use \scripts_path;
/* You can add arguments to the script if needed */
$script = Engine::spawn(scripts_path('screenshot.js'));
/* Use "with" to send data before executing */
$result = $script->with([
'url' => 'https://google.com'
]);
printf(
"Job ID: %s, Exit Code: %d",
$result->output['job_id'],
$result->status()
);
/* If not sending any data, you can use ->run() */