From 8c50dec4736cb16ea42418035d0895e9dc3d98a5 Mon Sep 17 00:00:00 2001 From: Jagepard Date: Thu, 21 May 2026 11:15:19 +0300 Subject: [PATCH] add Attributes --- .../AfterMiddleware.php} | 13 +++++++---- src/Attributes/Middleware.php | 23 +++++++++++++++++++ src/Attributes/Routing.php | 21 +++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) rename src/{Routing.php => Attributes/AfterMiddleware.php} (59%) mode change 100755 => 100644 create mode 100644 src/Attributes/Middleware.php create mode 100755 src/Attributes/Routing.php diff --git a/src/Routing.php b/src/Attributes/AfterMiddleware.php old mode 100755 new mode 100644 similarity index 59% rename from src/Routing.php rename to src/Attributes/AfterMiddleware.php index ac14ceb3..7268df3a --- a/src/Routing.php +++ b/src/Attributes/AfterMiddleware.php @@ -1,5 +1,7 @@ + * @license https://mozilla.org/MPL/2.0/ MPL-2.0 + */ + +namespace Rudra\Router\Attributes; + +#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Middleware +{ + public function __construct( + public string $name, + public string|null $params = null + ) {} +} diff --git a/src/Attributes/Routing.php b/src/Attributes/Routing.php new file mode 100755 index 00000000..d7472e5b --- /dev/null +++ b/src/Attributes/Routing.php @@ -0,0 +1,21 @@ + + * @license https://mozilla.org/MPL/2.0/ MPL-2.0 + */ + +namespace Rudra\Router\Attributes; + +#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class Routing +{ + public function __construct( + public string $url = '', + public string|array $method = 'GET' + ) {} +}