All Projects → phpsgi → Funk

phpsgi / Funk

Licence: other
Funk is a HTTP server implementation of PHPSGI. Implemented the lightweight middlewares, responder components...

Programming Languages

PHP
23972 projects - #3 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to Funk

PuppyProxy
A simple HTTP proxy in C# including support for HTTP CONNECT tunneling
Stars: ✭ 37 (+131.25%)
Mutual labels:  http-server
simple-http
Simple, portable HTTP server for .NET based on HttpListener.
Stars: ✭ 74 (+362.5%)
Mutual labels:  http-server
waspy
WASP framework for Python
Stars: ✭ 43 (+168.75%)
Mutual labels:  http-server
tracetrout
A magical reverse traceroute HTTP(S) server
Stars: ✭ 48 (+200%)
Mutual labels:  http-server
http-server-online
Start a local HTTP server without any tools, just open a web page.
Stars: ✭ 602 (+3662.5%)
Mutual labels:  http-server
EasyDSS
high performance,industrial rtmp streaming server,a lot of optimization on http,rtmp,hls,http-flv,streaming relay(rtmp pull relay/rtmp push relay),KeyFrame cache,GOP cache,RESTful,and recording, playback, record-download,web management. EasyDSS高性能RTMP流媒体服务器,支持RTMP推流,同步输出HTTP、RTMP、HLS、HTTP-FLV,支持推流分发/拉流分发,支持秒开、GOP缓冲、录像、检索、回放、录像下载、网页管理等多种功能,是目前市面上…
Stars: ✭ 34 (+112.5%)
Mutual labels:  http-server
gowebview
tool to build android apps with WebView from your golang http server; moved to gitlab.com/microo8/gowebview
Stars: ✭ 35 (+118.75%)
Mutual labels:  http-server
BCA-Phantom
A multi-platform HTTP(S) Reverse Shell Server and Client in Python 3
Stars: ✭ 80 (+400%)
Mutual labels:  http-server
blog
✍️无他术,唯勤读书而多为之,自工。
Stars: ✭ 62 (+287.5%)
Mutual labels:  http-server
mock-json-server
A mock web server using a JSON file with live-reload support.
Stars: ✭ 31 (+93.75%)
Mutual labels:  http-server
Pyro-FileStreamBot
Stream Telegram files to web
Stars: ✭ 38 (+137.5%)
Mutual labels:  http-server
v4l2web
V4L2 web interface
Stars: ✭ 20 (+25%)
Mutual labels:  http-server
phpkoa
PHP异步编程: 基于 PHP 实(chao)现(xi) NODEJS web框架 KOA。
Stars: ✭ 52 (+225%)
Mutual labels:  http-server
Polyel-Framework
⚡️ Voltis Core: A PHP framework based on Swoole from the ground up
Stars: ✭ 22 (+37.5%)
Mutual labels:  http-server
HTTPStaticServer
Bare-bones static HTTP server written in a single C file
Stars: ✭ 24 (+50%)
Mutual labels:  http-server
finch-server
Some base classes and configuration used for making a server using finch
Stars: ✭ 23 (+43.75%)
Mutual labels:  http-server
gotor
This program provides efficient web scraping services for Tor and non-Tor sites. The program has both a CLI and REST API.
Stars: ✭ 97 (+506.25%)
Mutual labels:  http-server
http
Extension module of golang http service
Stars: ✭ 57 (+256.25%)
Mutual labels:  http-server
ErpNet.FP
ErpNet.FP is a light-weight cross-platform Http server facilitating printing to fiscal printers through simple JSON Api.
Stars: ✭ 75 (+368.75%)
Mutual labels:  http-server
hello
Multi-threaded cross-platform HTTP/1.1 web server example in Zig.
Stars: ✭ 29 (+81.25%)
Mutual labels:  http-server

Funk

Build Status Coverage Status Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License Join the chat at https://gitter.im/phpsgi/funk Made in Taiwan

Funk is an implementation of PHPSGI. It supports HTTP servers implemented with PHP SAPI (Apache2 mod_php, php-fpm, fastcgi), therefore you can integrate your application with Funk and switch to different HTTP server implementation.

PHPSGI and Funk aims to provide lightweight HTTP interfaces, middlewares for web frameworks. It's a bit different from the PSR-7 spec. PHPSGI focuses on the core data structure instead of forcing components to implement the interface requirements.

Components

  • HTTP server (with event extension or socket_select)
  • SAPI support (php-fpm, apache2 php handler servers)
  • Middlewares
  • Middleware Compositor
  • A Simple Mux Builder (integrated with Pux)

Environment

// This creates $env array from $_SERVER, $_REQUEST, $_POST, $_GET ... 
$env = Environment::createFromGlobals();

Application

$app = function(array & $environment, array $response) {
    return [ 200, [ 'Content-Type' => 'text/plain' ], 'Hello World' ];
};

Responder

SAPIResponder

You can integrate your application with SAPIResponder to support Apache2 php handler / php-fpm / fastcgi.

use Funk\Responder\SAPIResponder;

$fd = fopen('php://output', 'w');
$responder = new SAPIResponder($fd);
$responder->respond([ 200, [ 'Content-Type: text/plain' ], 'Hello World' ]);
fclose($fd);
use Funk\Responder\SAPIResponder;

$env = Environment::createFromGlobals();
$app = function(array & $environment, array $response) {
    return [ 200, [ 'Content-Type' => 'text/plain' ], 'Hello World' ];
};
$fd = fopen('php://output', 'w');
$responder = new SAPIResponder($fd);
$responder->respond($app($env, []));
fclose($fd);

Middleware

  • Funk\Middleware\ContentNegotiationMiddleware
  • Funk\Middleware\CORSMiddleware
  • Funk\Middleware\GeocoderMiddleware
  • Funk\Middleware\HeadMiddleware
  • Funk\Middleware\TryCatchMiddleware
  • Funk\Middleware\XHProfMiddleware
  • Funk\Middleware\XHTTPMiddleware
use Funk\Environment;
use Funk\Middleware\TryCacheMiddleware;

$app = function(array $environment, array $response) {
    return [ 200,  ['Content-Type' => 'text/html' ], 'Hello World' ];
};
$middleware = new TryCatchMiddleware($app);


$env = Environment::createFromGlobals();
$response = $middleware($env, [200, [], []]);

Contributing

Testing XHProf Middleware

Define your XHPROF_ROOT in your phpunit.xml, you can copy phpunit.xml.dist to phpunit.xml, for example:

  <php>
    <env name="XHPROF_ROOT" value="/Users/c9s/src/php/xhprof"/>
  </php>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].