Skip to content

Folk-Project/folk-plugin-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

folk-plugin-http

HTTP plugin for Folk. Built on axum (hyper + tokio). Dispatches incoming HTTP requests to PHP workers via execute_value for zero-copy dispatch.

Version: 0.2.0

Configuration

[http]
listen = "0.0.0.0:8080"
Key Type Default Description
listen SocketAddr "0.0.0.0:8080" Address and port to bind

How it works

  1. Incoming HTTP request arrives via axum.
  2. Request (method, URI, headers, body) is converted to a serde_json::Value.
  3. Dispatched to a PHP worker via executor.execute_value() -- zero-copy, no JSON encode/decode.
  4. Worker returns a response value (status, headers, body), converted back to an HTTP response.

Error mapping: worker error -> 502, internal failure -> 500.

Graceful shutdown

The plugin listens on ctx.shutdown. On signal, it stops accepting new connections and drains in-flight requests before exiting.

Quick start

Add the plugin to folk.build.toml:

[[plugin]]
crate_name = "folk-plugin-http"
version = "0.2"
config_key = "http"

Configure in folk.toml:

[http]
listen = "0.0.0.0:8080"

Build and run:

folk-builder build
./my-folk serve
curl http://localhost:8080/

Requirements

License

MIT

About

HTTP/1.1 and HTTP/2 plugin for Folk — accepts connections via hyper and dispatches to PHP workers

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages