定制 blank-framework/file-path-router 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

blank-framework/file-path-router

最新稳定版本:2.0.1

Composer 安装命令:

composer require blank-framework/file-path-router

包简介

Package for the Blank Framework FilePathRouter

README 文档

README

FilePathRouter is a simple routing package that maps a path such as /blog/posts to the directory /blog/posts. If that directory exists, it executes the index.php file inside.

Usage

To start, instantiate the FilePathRouter class and pass the absolute path to the directory where your routes will be located. If it is in the root of your project directory is could be like the code snippet below:

$router = new FilePathRouter(__DIR__ . '/routes');

To route your requests, get the requested path for example /blog and pass it into the function routeRequest as shown below:

$router->routeRequest('/blog');

Directory Structure and Routing

FilePathRouter's routing mechanism is dependent on your project's directory structure. The home route (/) is mapped to the index.php file in the /routes directory. To create a new path, such as /blog, simply create a directory named blog within /routes. Place an index.php file in this new directory, and this file will be executed whenever the /blog path is requested.

Exceptions

If the routes path you provided in the constructor does not exist, the router will throw a RoutesPathNotFoundException. If the requested route could not be found, the router will throw a RouteNotFoundException.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-11-14