Skip to content

angleman/phpexe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phpexe

Execute PHP from within Node

Install

Requires PHP installed and available via your environment path.

npm install phpexe

Usage

sample.php

<?php
	echo "Hello"
?>

Node usage of sample.php

var php = require('phpexe');

php('sample.php', function(error, data) {
	if (error) {
		console.log(error) // PHP error or stderr
	} else {
		console.log(data); // PHP stdout  'Hello'
	}
});

var args = ['first parameter', 'second']
php('sample.php', args, function(error, data) {
	if (error) {
		console.log(error) // PHP error or stderr
	} else {
		console.log(data); // PHP stdout  'Hello'
	}
});

License

MIT

About

Execute PHP from within Node

Resources

License

Stars

Watchers

Forks

Packages

No packages published