slogsdon/fp-web
最新稳定版本:0.0.8
Composer 安装命令:
composer require slogsdon/fp-web
包简介
test bed for a functional web toolkit
README 文档
README
Test bed for a functional web toolkit
This is just an experiment for what a web toolkit that doesn't use object-oriented code.
In theory, this is just a bit of PHP and should be fine for use, but in practice, don't use this but use something more established, more tested, and more used instead.
Running the example
$ git clone https://github.com/slogsdon/php-fp-web
$ cd php-fp-web
$ composer install
$ php -S 0.0.0.0:8888 -t example
In another terminal session:
$ curl -i http://localhost:8800/index
HTTP/1.1 200 OK
Host: localhost:8888
Connection: close
X-Powered-By: PHP/5.6.10
Content-type: text/html; charset=UTF-8
index
$ curl -i http://localhost:8800/
HTTP/1.1 404 Not Found
Host: localhost:8888
Connection: close
X-Powered-By: PHP/5.6.10
Content-type: text/html; charset=UTF-8
Not Found
Usage
<?php require 'vendor/autoload.php'; use \FPWeb\App; use \FPWeb\Route; // index handler $index = function ($conn) { // TODO: make this process nicer $conn['response']['body'] = 'index'; return $conn; }; // create routes $routes = [ Route\get('/index', $index), ]; // match request and run match $response = App\run($routes, [ 'param_set' => [$_GET, $_POST], 'on_error' => function ($conn) { $conn['response']['body'] = 'Not Found'; return $conn; }, ]); printf('<pre><code>%s</code></pre>', print_r($response, true));
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-06