luminar-organization/router
Composer 安装命令:
composer require luminar-organization/router
包简介
A lightweight and flexible router for the Luminar Framework
README 文档
README
The Luminar Router is a lightweight routing component for the Luminar PHP framework. It allows you to define and manage routes in your application, supporting dependency injection and advanced route handling.
Installation
Install via Composer:
composer require luminar-organization/router
Basic Usage
Defining Routes
You can define routes using the Route annotation, specifying the HTTP method, the route pattern.
namespace App\Controllers; use Luminar\Http\Controller\AbstractController; use Luminar\Http\Response; class ExampleController extends AbstractController { public static string $response = "Hello World"; #[Route("/example", methods: "GET")] public function index(): Response { return $this->text($this::$response); } }
Handling Requests
To handle incoming HTTP requests, use the dispatch method
$response = $router->dispatch($_SERVER["REQUEST_METHOD"], $_SERVER["REQUEST_URI"]);
License
This package is open-sourced software licensed under the MIT License
This README provides an overview of how to use the luminar-organization/router component in your projects. It covers installation, basic routing.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-03