Middleware for Node.js (Express) that forwards HTTP requests to a built-in PHP development server. Version 1.0.1 is the latest stable release. It wraps two dependencies: proxy-middleware to proxy requests and php-built-in-server to spawn and manage a PHP process. Key differentiator: seamlessly integrates PHP processing into a Node.js/Express application without separate server setup. Supports configuration of PHP binary path, host, port, php.ini settings, and URL prefix for selective route forwarding. No updates since 2014.
npm install php-proxy-middlewareNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Set up an Express app that forwards requests to a PHP server located in the 'php' directory.
Use php({ root: 'path' }) or php('path') instead of php('path', port, host).Consider alternatives like node-php-proxy or custom implementation using http-proxy-middleware.
Use a real PHP-FPM setup behind nginx for production.
Ensure PHP is installed and accessible. Check with `php -v`.
Ensure URLs are properly encoded before passing to PHP.
Install PHP and ensure it is in PATH, or set phpPath option to full path of PHP executable.
Use const php = require('php-proxy-middleware'); or import php from 'php-proxy-middleware' (with esModuleInterop).Specify a different port using the port option, or kill the process using that port.