guinso/hx-route 问题修复 & 功能扩展

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

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

guinso/hx-route

Composer 安装命令:

composer require guinso/hx-route

包简介

HTTP REST router

关键字:

README 文档

README

Simple HTTP routing utility. Can use for REST handler.

Install Package

Composer

//for PHP 7
{
  "require": {
    "guinso/hx-route": "2.0.*"
  }
}

//for PHP 5
{
  "require": {
    "guinso/hx-route": "1.0.*"
  }
}

Manual

require_once("hx-route-directory/src/autoloader.php");

Example

// method options: GET, POST, PUT, DELETE, or any standard HTTP method
//$inputData specification can read from hx-http
//$inputData = array(
//    "data" => ....  client input value
//   "file" => ... client upload file path value
//);
$routeConfigure = array(
	new \Hx\Route\Info("/your/customer/(\w+)", "GET", function($arg, $inputData) {
		$urlArgument = $arg[0]; //this is value from URL argument (\w+)

		//get general value
		$clientSpecificKeyValue = $inputData["date"]["clientSpecificKey"];

		//get temporary uploaded file path
		$clientUploadFilePath = $inputData["file"]["clientSpecificFileName"];
	},

	new \Hx\Route\Info("/another/custom/path", "POST", function($arg, $inputData) {
		//handle another request
	}
);

//initialize URL routing handler
$router = new \Hx\Route\RestRouter(
  new \Hx\Route\Mapper($routeConfigure), 
  new \Hx\Http\HeaderReader(), 
  new \Hx\Http\InputService());

$router->run(); //start process incoming request URL

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固