Skip to content

Commit 4cf4883

Browse files
committed
add options
1 parent 7687fe1 commit 4cf4883

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

src/Route.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,32 @@ public static function head($path, $callback)
9797
static::addRoute('HEAD', $path, $callback);
9898
}
9999

100+
/**
101+
* @param $path
102+
* @param $callback
103+
*/
104+
public static function options($path, $callback)
105+
{
106+
static::addRoute('OPTIONS', $path, $callback);
107+
}
108+
100109
/**
101110
* @param $path
102111
* @param $callback
103112
*/
104113
public static function any($path, $callback)
105114
{
106-
static::addRoute(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'], $path, $callback);
115+
static::addRoute(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'], $path, $callback);
116+
}
117+
118+
/**
119+
* @param $method
120+
* @param $path
121+
* @param $callback
122+
*/
123+
public static function add($method, $path, $callback)
124+
{
125+
static::addRoute($method, $path, $callback);
107126
}
108127

109128
/**

0 commit comments

Comments
 (0)