Gathering detailed insights and metrics for gulp-connect-php-mb-path
Gathering detailed insights and metrics for gulp-connect-php-mb-path
Gathering detailed insights and metrics for gulp-connect-php-mb-path
Gathering detailed insights and metrics for gulp-connect-php-mb-path
npm install gulp-connect-php-mb-path
Typescript
Module System
Node Version
NPM Version
JavaScript (95.08%)
Shell (4.92%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
153 Stars
66 Commits
31 Forks
8 Watchers
3 Branches
10 Contributors
Updated on May 26, 2025
Latest Version
0.0.1
Package Id
gulp-connect-php-mb-path@0.0.1
Unpacked Size
106.12 kB
Size
28.22 kB
File Count
22
NPM Version
5.6.0
Node Version
8.9.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
REQUIRES NODE 4 OR GREATER
Start a PHP-server
This is pretty much a gulp version of @sindresorhus's grunt-php and acts as a basic version drop-in replacement for gulp-connect, though please note not all features from gulp-connect are supported with gulp-connect-php. I am open to supporting other features and pull requests that implement them.
Uses the built-in server in PHP 5.4.0+.
1$ npm install --save-dev gulp-connect-php
1var gulp = require('gulp'), 2 connect = require('gulp-connect-php'); 3 4gulp.task('connect', function() { 5 connect.server(); 6}); 7 8gulp.task('default', ['connect']);
1var gulp = require('gulp'), 2 connect = require('gulp-connect-php'); 3 4let server = new connect(); 5 6gulp.task('connect', function() { 7 server.server(); 8}); 9gulp.task('disconnect', function() { 10 server.closeServer(); 11}); 12 13gulp.task('default', ['connect', 'disconnect']);
1var gulp = require('gulp'), 2 connect = require('gulp-connect-php'), 3 browserSync = require('browser-sync'); 4 5gulp.task('connect-sync', function() { 6 connect.server({}, function (){ 7 browserSync({ 8 proxy: '127.0.0.1:8000' 9 }); 10 }); 11 12 gulp.watch('**/*.php').on('change', function () { 13 browserSync.reload(); 14 }); 15});
1gulp.task('connect', function() { 2 connect.server({ 3 configCallback: function _configCallback(type, collection) { 4 // If you wish to leave one of the argument types alone, simply return the passed in collection. 5 if (type === connect.OPTIONS_SPAWN_OBJ) { // As the constant suggests, collection is an Object. 6 7 // Lets add a custom env var. Good for injecting AWS_RDS config variables. 8 collection.env = Object.assign({ 9 MY_CUSTOM_ENV_VAR: "env_var_value" 10 }, process.env); 11 12 return collection; 13 } else if (type === connect.OPTIONS_PHP_CLI_ARR) { // As the constant suggests, collection is an Array. 14 let newArgs = [ 15 '-e', // Generate extended information for debugger/profiler. 16 '-d', 'memory_limit=2G' // Define INI entry, Up memory limit to 2G. 17 ]; 18 19 // Ensure our argument switches appear before the rest. 20 return newArgs.concat(collection); 21 } 22 } 23 }, function _connected_callback() { 24 console.log("PHP Development Server Connected."); 25 }); 26}); 27 28gulp.task('disconnect', function() { 29 connect.closeServer(); 30}); 31 32gulp.task('default', ['connect', 'disconnect']);
Windows Batch file execution via a %PATH%
specified batchfile is possible, but some considerations are required.
%PATH%
and executable with permissions of the invoker.shell
option on spawn(...)
.C:\Users\mainuser\Applications\PHP\7.0.17-NTS-VC14\php.exe
.C:\Users\mainuser\MyProject\strap\php.bat
.%PATH%
manually to C:\Users\mainuser\MyProject\strap\;%PATH%
.1@echo off 2 3REM We specify the whole path to PHP since the working directory is that of gulp... 4REM unless we also changed that in our gulp callback. 5 6C:\Users\mainuser\Applications\PHP\7.0.17-NTS-VC14\php.exe %*
1gulp.task('connect', function _gulp_connect_task() { 2 connect.server({ 3 configCallback: function _configCallback(type, collection) { 4 if (type === connect.OPTIONS_SPAWN_OBJ) { 5 // Windows Batch files are NOT executable on their own. This will start a shell 6 // session then execute. 7 collection.shell = true; 8 return collection; 9 } 10 } 11 }, function _connected_callback() { 12 console.log("PHP Development Server Connected."); 13 }); 14}); 15 16gulp.task('default', ['connect']);
Type: number
Default: 8000
The port on which you want to access the webserver. Task will fail if the port is already in use.
Type: string
Default: '127.0.0.1'
(usually same as localhost
)
The hostname the webserver will use.
Use 0.0.0.0
if you want it to be accessible from the outside.
Type: string
Default: '.'
From which folder the webserver will be served. Defaults to the directory of the gulpfile.
Type: boolean
Default: false
Open the server in the browser when the task is triggered.
Type: string
Optionally specify the path to a router script that is run at the start of each HTTP request. If this script returns false
, then the requested resource is returned as-is. Otherwise the script's output is returned to the browser.
Example router script:
1<?php 2// router.php 3if (preg_match('/\.(?:png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) { 4 return false; // serve the requested resource as-is 5} else { 6 echo "<p>Thanks for using gulp-connect-php :)</p>"; 7} 8?>
Type: string
Default: 'php'
Path to the PHP binary. Useful if you have multiple versions of PHP installed.
Type: string
Default: Built-in php.ini
Path to a custom php.ini
config file.
Type: string
Default: 'inherit'
Node's stdio parameter, set it to 'ignore'
to suppress all the logging into console of the php server process.
Type: function (type, collection) : collection
Prototype:
type
- String, either OPTIONS_SPAWN_OBJ
or OPTIONS_PHP_CLI_ARR
.
collection
- Array or Object, the initial version of the collection specified by type
.
Return: Optionally modified version of collection
.
Default: 'null'
(Which is replaced with a no-op call that returns an unmodified version of the collection
parameter)
Allows the caller to modify the spawn
options object and or the PHP command line arguments (array) before the PHP development server is invoked.
Type: boolean
Default: 'false'
Enables debugging of the spawn call and its parameters.
This package comes with a NPM run-script command called prepack
. This is intended to be run before the packaging and pushing to NPM, however it is also what builds the Node 4.X compatibility script index-compat.js
. Without it the default package.json
will not execute properly.
MIT © Micah Blu
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/11 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
52 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More