Skip to content

Commit 85ed092

Browse files
committed
✨ added quick requests to fetch
1 parent 8e238ae commit 85ed092

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Fetch.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,21 @@ public static function buildHTTPCurlQuery($data, $parent = false)
453453
}
454454
}
455455

456-
function fetch($options)
456+
/**
457+
* Shortcut method for making network requests.
458+
*
459+
* @param array|string $options The url or request to hit.
460+
*/
461+
function fetch($options, $params = [])
457462
{
463+
if (is_string($options)) {
464+
$options = ["url" => $options];
465+
466+
if (count($params) > 0) {
467+
$options["method"] = Fetch::POST;
468+
$options["data"] = $params;
469+
}
470+
}
471+
458472
return Fetch::request($options);
459473
}

0 commit comments

Comments
 (0)