Skip to content

contentasaurus/node-php-process

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-php-process

Provides a standard for handing off processing to node and having node respond with its results.

In PHP

include 'src/NodePhpProcess.php';

use contentasaurus\NodePhpProcess;

$process = new NodePhpProcess();
$process
	->script_path(__DIR__)
	->content([
		'test' => 'json'
	])
	->run('errors.js')
	->output($output)
	->errors($errors);

// exit(var_dump($errors));
if(!empty($errors)) {
	trigger_error($errors, E_USER_ERROR);
	exit();
}

exit($output);

In JS

const requestProcessor = require('../src/RequestProcessor')

requestProcessor()
.then(data => {
	process.stdout.write(JSON.stringify(data))
})
.catch(err => {
	process.stderr.write(err)
})

About

Provides a standard for handing off processing to node and having node respond with its results.

Resources

License

Stars

Watchers

Forks

Packages

No packages published