switon/router

Route matching, parameter resolution, and path mapping for Switon Framework

Maintainers

Package info

github.com/switon-php/router

Documentation

pkg:composer/switon/router

Statistics

Installs: 22

Dependents: 5

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-10 03:31 UTC

This package is auto-updated.

Last update: 2026-05-10 03:33:42 UTC


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.