1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-01 09:52:59 +02:00

Add support for Symfony Response creation

This would make response method play nice with Symfony, Silex and any other project that uses Symfony's http stack.
This commit is contained in:
Igor Tarasov
2019-01-21 21:19:13 +03:00
committed by GitHub
parent e82d274f78
commit f936e64e2f

View File

@@ -57,6 +57,12 @@ class Response
$response->header('Content-Type', $mime);
$response->header('Content-Length', $length);
} elseif (class_exists(\Symfony\Component\HttpFoundation\Response::class)) {
$response = \Symfony\Component\HttpFoundation\Response::create($data);
$response->headers->set('Content-Type', $mime);
$response->headers->set('Content-Length', $length);
} else {
header('Content-Type: ' . $mime);