lean/src/Factory/HttpFactoryInterface.php
2025-05-12 15:06:47 +00:00

23 lines
1.5 KiB
PHP

<?php
namespace Lean\Factory;
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, RedirectResponse, TextResponse};
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
use Laminas\Diactoros\Response;
use Psr\Http\Message\ResponseInterface;
interface HttpFactoryInterface
{
public static function createResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface;
public static function createRedirectResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface;
public static function createHtmlResponse(string $html, int $code = 200, array $headers = []) : ResponseInterface;
public static function createTextResponse(string $text, int $code = 200, array $headers = []) : ResponseInterface;
public static function createJsonResponse(mixed $data, int $code = 200, array $headers = []) : ResponseInterface;
public static function createEmptyResponse(int $code = 204, array $headers = []) : ResponseInterface;
public static function createPdfResponse(\Stringable|string $binary, int $code = 200, array $headers = []) : ResponseInterface;
public static function createDownloadableResponse(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface;
public static function createImageResponse(string $data, int $code = 200, array $headers = []) : ResponseInterface;
public static function createFileDownloadResponse(string $path, int $code = 200, array $headers = []) : ResponseInterface;
}