承接 lorenzo-d-alipio/basicrouter 相关项目开发

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

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

lorenzo-d-alipio/basicrouter

Composer 安装命令:

composer require lorenzo-d-alipio/basicrouter

包简介

Simple router forked from simonham with simple modifications

关键字:

README 文档

README

This router is based on simonhamp/routes of which I forked months ago. There is nothing wrong about the original router. However, I decided to add another method to extract the controller and the controller method from the route() shown in the original class.

Installation

This can be installed using composer.

{
"require":{
              "basicrouter": "dev-master"
			
	},
   "repositories": [

{ "type": "vcs", "url": "https://github.com/Bryan-D-Lee/basicrouter"

} ]

}

If you install it via composer, make sure to add namespace on top of the Router class.


<?php namespace System\Libraries;

Example of composer installed


<?php

require_once(DIR .'/vendor/autoload.php');

$routes = array(

    'controller/(:any)/(:any)/(:any)' => 'test/index/$1/$2/$3/',
    'register/' => 'MyController/myController_action'

    );

$url = 'dir/controller/method/param_one/param_two/param_threee'; $default_dir = ('dir/'); $request = trim(str_replace($default_dir, '', $url));

System\Libraries\Router::add($routes); $action_request = System\Libraries\Router::route($request);

print_r(array_filter($action_request));

Alternative installation example


<?php

include('Router.php');

$routes = array(

    'controller/(:any)/(:any)/(:any)' => 'test/index/$1/$2/$3/',
    'register/' => 'MyController/myController_action'

    );

$url = 'dir/controller/method/param_one/param_two/param_threee'; $default_dir = ('dir/'); $request = trim(str_replace($default_dir, '', $url));

Router::add($routes); $action_request = Router::route($request);

print_r(array_filter($action_request));

The above examples should return something like this

Array ( [0] => test [1] => index [2] => method [3] => param_one [4] => param_two [5] => param_threee )

By writing a simple dispatcher, we can easily dispatch the controller/action + parameters (coming up soon).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-04