--- /dev/null
+<?php
+
+namespace wcf\http;
+
+use Psr\Http\Message\ServerRequestInterface;
+
+/**
+ * Provides various helper methods for PSR-7/PSR-15 request processing.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2022 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Http
+ * @since 6.0
+ */
+final class Helper
+{
+ /**
+ * Returns whether the request's 'x-requested-with' header is equal
+ * to 'XMLHttpRequest'.
+ */
+ public static function isAjaxRequest(ServerRequestInterface $request): bool
+ {
+ return $request->getHeaderLine('x-requested-with') === 'XMLHttpRequest';
+ }
+
+ /**
+ * Forbid creation of Helper objects.
+ */
+ private function __construct()
+ {
+ // does nothing
+ }
+}