mosz/simple-router
最新稳定版本:v1.0
Composer 安装命令:
composer require mosz/simple-router
包简介
Simple MVC Router for php
README 文档
README
Simple object oriented Router for php
- Support
GET,POSTmethods
Installation
Run the following command
composer require mosz/simple-router
Usage
basic index.php file
// Require composer autoloader require __DIR__ . '/vendor/autoload.php'; // Create Router instance $router = new mOsz\Router\Router($_SERVER['REQUEST_URI']); // Add routes $router->get('path', function(){ ... }); $router->run();
Routes utilisation :
- Basic use
$router->get('HelloWorld', function(){ echo "Hello World"; });
MVC
- GET method
$router->get('Homepage', function(){ $controller = new Test\Controller; $controller->index(); });
- GET method with params
$router->get('posts/{id}', function($id) { $controller = new Test\Controller; $controller->posts($id); });
- POST method
$router->get('form', function() { $controller = new Test\Controller; $controller->form(); });
Form traitement example
$router->post('form', function() { $controller = new Test\Controller; $controller->form(); });
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-07-29