{"id":14978568,"url":"https://github.com/ivanfilhoz/node-php-fpm","last_synced_at":"2025-10-28T11:30:22.317Z","repository":{"id":57323249,"uuid":"108019151","full_name":"ivanfilhoz/node-php-fpm","owner":"ivanfilhoz","description":"Simple, middleware-style PHP binding for Node.","archived":false,"fork":false,"pushed_at":"2019-06-13T07:14:00.000Z","size":27,"stargazers_count":19,"open_issues_count":2,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T05:33:57.581Z","etag":null,"topics":["apache","javascript","nginx","nodejs","npm","php"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanfilhoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-23T18:01:15.000Z","updated_at":"2024-09-18T23:46:50.000Z","dependencies_parsed_at":"2022-09-12T06:30:23.919Z","dependency_job_id":null,"html_url":"https://github.com/ivanfilhoz/node-php-fpm","commit_stats":null,"previous_names":["ivanslf/node-php-fpm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfilhoz%2Fnode-php-fpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfilhoz%2Fnode-php-fpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfilhoz%2Fnode-php-fpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanfilhoz%2Fnode-php-fpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanfilhoz","download_url":"https://codeload.github.com/ivanfilhoz/node-php-fpm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238638160,"owners_count":19505548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","javascript","nginx","nodejs","npm","php"],"created_at":"2024-09-24T13:57:55.608Z","updated_at":"2025-10-28T11:30:19.974Z","avatar_url":"https://github.com/ivanfilhoz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-php-fpm\n\n[![NPM Version][npm-image]][npm-url]\n[![Github License][license-image]](LICENSE)\n[![NPM Downloads][downloads-image]][npm-url]\n\n## Install\n\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```sh\n$ npm install php-fpm\n```\n\n## Examples\n\n### Using with `http`\n\n```js\nconst http = require('http')\nconst phpFpm = require('php-fpm')\nconst serveStatic = require('serve-static')\n\nconst php = phpFpm() // Optional: parameters for fastcgi-client\nconst serve = serveStatic(__dirname)\n\nconst server = http.createServer(function (req, res) {\n  if (req.url.match(/\\.php(\\?.*)?$/)) {\n    php(req, res)\n  } else {\n    serve(req, res)\n  }\n})\n\nserver.listen(8080)\n```\n\n### Using with `express`\n\n```js\nconst express = require('express')\nconst phpFpm = require('php-fpm')\n\nconst app = express()\n\napp.use(phpFpm())\n\napp.listen(8080)\n```\n\n## API\n\nThe available parameters for `php-fpm` are:\n\n```js\nphpFpm(\n  userOptions = {\n    // Parameters for fastcgi-client\n    host: '127.0.0.1',\n    port: 9000,\n    documentRoot: __dirname,\n    skipCheckServer: true\n  },\n  customParams = {\n    // Headers for php-fpm (automatically set)\n    uri, // REQUEST_URI\n    document, // DOCUMENT_URI\n    query, // QUERY_STRING\n    script // SCRIPT_FILENAME\n  }\n)\n```\n\nParameters for `fastcgi-client` are available [here](https://github.com/LastLeaf/node-fastcgi-client#api).\n\n## `rewrite` option\n\nThere is an implementation of the `rewrite` module to handle routes the traditional nginx/Apache way.\n\n```js\nconst phpFpm = require('php-fpm')\n\n// Route rewrite for Phalcon framework\nconst php = phpFpm({\n  rewrite: [\n    {\n      rule: /.*/, // Default rule, can be omitted\n      replace: '/index.php?_url=$0'\n    }\n  ]\n})\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/php-fpm.svg\n[license-image]: https://img.shields.io/github/license/ivanslf/node-php-fpm.svg\n[downloads-image]: https://img.shields.io/npm/dm/php-fpm.svg\n[npm-url]: https://npmjs.org/package/php-fpm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanfilhoz%2Fnode-php-fpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanfilhoz%2Fnode-php-fpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanfilhoz%2Fnode-php-fpm/lists"}