https://github.com/perongh/nextphp
NextPHP is a web framework enabling you to write PHP in JavaScript.
https://github.com/perongh/nextphp
Last synced: about 2 months ago
JSON representation
NextPHP is a web framework enabling you to write PHP in JavaScript.
- Host: GitHub
- URL: https://github.com/perongh/nextphp
- Owner: PeronGH
- Created: 2023-11-29T18:56:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-30T14:49:38.000Z (over 1 year ago)
- Last Synced: 2025-01-19T09:42:18.351Z (4 months ago)
- Language: TypeScript
- Homepage: https://nextphp.deno.dev
- Size: 18.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NextPHP
NextPHP is a web framework for people who love PHP so much that they want to write it in JavaScript.
## Features
- PHP-like development experience, but in JavaScript
- Full support for SSR
- Filesystem-based routing
- Can run on Deno Deploy## How does PHP written in JavaScript look like?
### Form Submission
```ejs
<% if (req.method === 'POST') { %>
<%- await include('../partials/greeting', { name: (await req.formData()).get('name') }) %>
<% } else { %>
Greet
<% } %>```
### JSON Response
```ejs
<%
res.headers.set('Content-Type', 'application/json')
echo(JSON.stringify(Object.fromEntries(req.headers)))
%>
```## Usage
Check the `example` folder for a simple example. Basically, all you need to do is `Deno.serve(createHandler(...))`, where `createHandler` can be imported from .