承接 umityatarkalkmaz/route 相关项目开发

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

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

umityatarkalkmaz/route

Composer 安装命令:

composer require umityatarkalkmaz/route

包简介

A simple PHP routing class

README 文档

README

This class is used to route and process incoming requests to specific URL addresses. In this way, it allows the application to perform different actions for different URL addresses.

Route::get('/', function(){echo 'something'});

get($path, $callback); Adds GET routes.

Route::post($path, $callback);

post($path, $callback); Adds POST routes.

Route::prefix('/admin'); 

prefix($prefix); Adds prefix.

prefix(...)->group(function{get('/',{echo 'something'})});

group($closure); Adds a prefix to the group.

get(...)->where('username', '[a-z]+'); 

where($key, $pattern); Adds new pattern.

Route::dispatch();

dispatch(); Processes routes.

Usage Example

require 'path/to/route.php';
use UmitYatarkalkmaz\Route;

Route::get('/', 'mainmenu@main');

Route::prefix('/admin')->group(function () {
    Route::get('/', function () {
        echo 'Admin dashboard';
    });
    Route::get('/apps', function () {
        echo 'Admin apps';
    });
});

Route::prefix('/user')->group(function () {
    Route::get('/', function () {
        echo 'User index';
    });
    Route::get('/:username', function ($user) {
        echo 'Wellcome ' . $user;
    })->where('username', '[a-z]+');
    Route::get('/apps/:username', function ($user) {
        echo $user . "'s apps";
    });
});
Route::prefix('mainPrefix');
Route::get('/','mainPrefix@main');

Route::dispatch();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-13