https://github.com/mitchmac/serverlesswp-node
Node.js library to run PHP on Vercel, Netlify, or AWS Lambda
https://github.com/mitchmac/serverlesswp-node
Last synced: 11 months ago
JSON representation
Node.js library to run PHP on Vercel, Netlify, or AWS Lambda
- Host: GitHub
- URL: https://github.com/mitchmac/serverlesswp-node
- Owner: mitchmac
- License: mit
- Created: 2023-07-25T13:43:08.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-05T02:28:21.000Z (about 1 year ago)
- Last Synced: 2025-04-05T02:33:30.454Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 58.5 MB
- Stars: 23
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# ServerlessWP
Serverless PHP on AWS Lambda, Vercel or Netlify
Just want to get started with WordPress?
Try the [WordPress starter project](https://github.com/mitchmac/serverlesswp)!
| Netlify | Vercel |
| --- | --- |
| [](https://app.netlify.com/start/deploy?repository=https://github.com/mitchmac/serverlesswp) |[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmitchmac%2Fserverlesswp) |
## Overview
This is the library that powers ServerlessWP but it can also be used standalone to execute PHP in Lambda functions.
ServerlessWP includes PHP 8.1 with common extensions and libraries required by WordPress to run in the serverless function Node.js runtimes of Vercel and Netlify.
## Usage
```
npm i serverlesswp
```
Then in your project's function directory use the ServerlessWP library in a file like api/index.js:
```javascript
const path = require('path');
const serverlesswp = require('serverlesswp');
exports.handler = async function (event, context, callback) {
const pathToWP = path.join(process.cwd(), 'wp');
return await serverlesswp({docRoot: pathToWP, event: event});
}
```
Where
* docRoot is the path to WordPress files
* event is the serverless event data from Vercel or Netlify
## License
MIT