27 lines
812 B
PHP
27 lines
812 B
PHP
<?php
|
|
|
|
namespace KTXF\Routing\Attributes;
|
|
|
|
use Attribute;
|
|
|
|
/**
|
|
* Marks a controller method as a prefix-matched anonymous route.
|
|
*
|
|
* Unlike AnonymousRoute (exact match), this attribute matches any request
|
|
* whose path *starts with* the given $path prefix, making it suitable for
|
|
* mounting sub-frameworks (e.g. sabre/dav) under a well-known URL tree.
|
|
*
|
|
* When $absolute is true the module prefix (/m/{handle}) is NOT prepended,
|
|
* so the route is registered exactly at $path from the root.
|
|
*/
|
|
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)]
|
|
class AnonymousPrefixRoute
|
|
{
|
|
public function __construct(
|
|
public readonly string $path,
|
|
public readonly string $name,
|
|
public readonly array $methods = ['GET'],
|
|
public readonly bool $absolute = false,
|
|
) {}
|
|
}
|