switon / router
Route matching, parameter resolution, and path mapping for Switon Framework
v1.0.0
2026-05-10 03:31 UTC
Requires
- php: >=8.3
- psr/event-dispatcher: ^1.0
- switon/core: ^1.0
- switon/event: ^1.0
Requires (Dev)
- switon/testing: ^1.0
README
Route matching, parameter resolution, and path mapping for Switon Framework.
Installation
composer require switon/router
Requirements: PHP 8.3+
Quick Start
use Switon\Routing\Attribute\GetMapping; use Switon\Routing\Attribute\PostMapping; use Switon\Routing\Attribute\RequestMapping; #[RequestMapping('/user')] class UserRoutes { #[GetMapping('')] public function indexAction(): array { return ['users' => []]; } #[GetMapping('{id}')] public function showAction(int $id): array { return ['user' => ['id' => $id]]; } #[PostMapping('')] public function createAction(): array { return ['created' => true]; } }
Docs: https://docs.switon.dev/latest/router
License
MIT.