phpexe

0.2.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i phpexe

Weekly Downloads

2

Version

0.2.2

License

MIT

Last publish

Collaborators

  • angleman