feat: add prefixed route
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
26
shared/lib/Routing/Attributes/AnonymousPrefixRoute.php
Normal file
26
shared/lib/Routing/Attributes/AnonymousPrefixRoute.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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,
|
||||
) {}
|
||||
}
|
||||
Reference in New Issue
Block a user