1.3.3 • Published 5 years ago

php-server-manager v1.3.3

Weekly downloads
37
License
MIT
Repository
github
Last release
5 years ago

PHP Server Manager

Package to manage the PHP built-in server from node.

Install

yarn add php-server-manager

Usage

const PHPServer = require('php-server-manager');

const server = new PHPServer();

server.run(cb); // http://localhost:8000

Callback vs Promise

You can pass a callback to the run method, this will get called when the PHP server is up and running. If you don't pass a callback to the run method, a promise will be returned that resolves when the PHP server is up and running.

Configuration

NameDefaultDescription
phpphpThe php command file
host127.0.0.1The server's host
port8000The port used
directorynullThe document root. By default is the current working directory
scriptnullThe "router" script
stdioinheritstdio option passed to the spawned process - https://nodejs.org/api/child_process.html#child_process_options_stdio
directives{}An object with the custom PHP directives
confignullThe path of a custom php.ini file
envprocess.envThe environment variables passed

Example:

const PHPServer = require('php-server-manager');

const server = new PHPServer({
    port: 3000,
    directives: {
        display_errors: 0,
        expose_php: 0
    }
});

server.run();

Quick use

You can use the static function start() to create and run a PHPServer in a single line:

PHPServer.start();

Use with gulp

gulp.task('php-server', () =>
    PHPServer.start({
        directory: 'public',
        script: 'public/index.php'
    })
);
1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago