承接 stg/ieu_http 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

stg/ieu_http

Composer 安装命令:

composer require stg/ieu_http

包简介

Lib for handling http requests and responses

README 文档

README

Request

Object representing a HTTP request.

Response

Object representing a HTTP response.

JsonResponse

Response transporting JSON encoded content.

RedirectResponse

Response using redirect header and meta-refresh.

Router

Routes request to the responsible handler.

Route

URL path description, including variables, variable validation and wildcardpattern.

Usage

// {id} matches didgits of all length
$route1a = (new Route('/path/to/user/{id}'))
	->validate('id', '\d+');

// or shorthand

$route1b = (new Route('/path/to/user/{id|\d+}'));

// {everything} matches all allowed chars.
$route2 = new Route('/path/to/{everything}/update');

// Will match every route beginning with /path/to/
$route3 = new Route('/path/to/*')

RouterProvider

For the use in ieu\Container\Container dependency containers. Implements the same interface as Router. Handlers used in RouterProvider::then-method have access to all dependencies known to the container and additional to Request (the current request) and RouteParameter (all variables found in the route pattern).

Usage

// ieu\Container
(new ieu\Container\Container)
	->provider('Router', new ieu\Http\RouterProvier)
	->config(['RouterProvider', function($routerProvider){
		$routerProvider
			->get('/home', ['Request', 'RouteParameter', function($request, $parameter){
				return new Response('This is the homepage ');
			})
			->otherwise(['Request', 'Error', function($request, $error) {
				// handle error
			});
	}]);

// ieu\App
(new ieu\App)
	->config(['RouterProvider', function($routerProvider){
		$routerProvider
			->get('/home', ['Request', 'RouteParameter', function($request, $parameter){
				return new Response('This is the homepage ');
			});
	}]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固