firewox/f-routes 问题修复 & 功能扩展

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

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

firewox/f-routes

Composer 安装命令:

composer require firewox/f-routes

包简介

Library for generating slim routes using PHP attributes

README 文档

README

This project has been created for the purpose of:

  1. Simplifying creation of Slim routes
  2. Making routes more readable and easier to understand

Getting Started

  1. Install composer package
  2. Register the route processor
  3. Add controllers
  4. Add middleware

Installation

composer require firewox/f-routes

Registering Route Processor

Put the following code into your index.php:

<?php

use DI\Container;
use Firewox\FRoutes\Factory;

$processor = Factory::create(
  new Container(),
  'Firewox\Tests\Controllers'       /* Namespace for controllers */
);

// Run the Slim app 
$processor->getApp()->run();

If you also have middleware for Slim you can include the middleware namespace as follows:

<?php

use DI\Container;
use Firewox\FRoutes\Factory;

$processor = Factory::create(
  new Container(),
  'Firewox\Tests\Controllers',       /* Namespace for controllers */
  'Firewox\Tests\Middlewares'       /* Namespace for middlewares */
);

// Run the Slim app 
$processor->getApp()->run();

Creating route controllers

Blah blah blah

  1. Application routes
  2. Group routes

Creating middleware

Blah blah blah

  1. Application middleware
  2. Group middleware
  3. Route middleware

Attributes Documentation

Controller Attribute

PropertyDescriptionPossible Values
isGroupGroup controller or not. (Default: false)true or false
pathPatternSlim compliant route path. (Default: '')Any valid path
middlewaresSlim middleware class names. Not necessarily marked with Middleware attribute. (Default: [])0 or more class names

Route Attribute

PropertyDescriptionPossible Values
methodsValid slim HTTP verbs. (Required)POST, PUT, GET, PATCH, DELETE, OPTIONS
pathPatternSlim compliant route path. (Required)Any valid path
nameName of the route. (Default: null)Any valid name
defaultApplication level default route or not. **(Default: false). Ex. 404 default route.true or false
priorityOrder in which route should be registered. Multiple routes can have the same number. (Default: 0)Any number as needed
middlewaresList of middleware class names. Not necessarily marked with Middleware attribute. (Default: [])0 or more class names
groupController class name. The controller class must be marked with Controller attribute with isGroup = true. (Default: null)Valid class name

Middleware Attribute

PropertyDescriptionPossible Values
priorityOrder in which middleware should be registered. Multiple middleware can have the same number. (Default: 0)Any number as needed

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固