aboutsummaryrefslogtreecommitdiff
path: root/src/Attribute/Middleware.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Attribute/Middleware.php')
-rw-r--r--src/Attribute/Middleware.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Attribute/Middleware.php b/src/Attribute/Middleware.php
new file mode 100644
index 0000000..e98c580
--- /dev/null
+++ b/src/Attribute/Middleware.php
@@ -0,0 +1,21 @@
+<?php
+
+declare(strict_types=1);
+
+namespace BrettParson\MiniRoute\Attribute;
+
+use Attribute;
+
+/**
+ * Declares middleware to apply to a controller method or class.
+ *
+ * Repeatable, and valid on both classes (applies to every method) and
+ * individual methods (applies only to that method).
+ */
+#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
+final class Middleware
+{
+ public function __construct(public readonly string $middlewareClass)
+ {
+ }
+}