mariuslundgard/php-server 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mariuslundgard/php-server

Composer 安装命令:

composer require mariuslundgard/php-server

包简介

A minimal routable HTTP middleware framework for PHP.

README 文档

README

Build Status Coverage Status

Latest Stable Version

Features

  • Routable middleware (application layers)
  • Routable controller actions

Examples

This is the canonical Hello World example:

<?php 

require 'vendor/autoload.php';

$app = (new Server\Module())
	->map([
		'fn' => function ($req, $res) {
			$res->write('<h1>Hello, world</h1>');
		}
	])
	->call()  // calls the application
	->send(); // outputs the headers and response body

This example shows how to use middleware and map controllers:

<?php

require 'vendor/autoload.php';

class HeaderFilter extends Server\Layer
{
    public function call(Server\Request $req = null, Server\Error $err = null)
    {
        $res = parent::call($req, $err);

        $res->body = '<h1>'.$res->body.'</h1>';

        return $res;
    }
}

class FrontController extends Server\Controller
{
    public function index()
    {
        return 'Hello, world!';
    }
}

$app = new Server\Module();

$app->employ([
    'class' => 'HeaderFilter',
]);

$app->map([
    'controller' => 'FrontController',
]);

$app->call()->send(); // outputs: <h1>Hello, world!</h1>

统计信息

  • 总下载量: 36
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固