Created
July 9, 2015 08:46
-
-
Save csarrazi/14b2e686966852e62d4e to your computer and use it in GitHub Desktop.
Stream a file using a StreamResponse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\DependencyInjection\ContainerAware; | |
use Csa\Bundle\GuzzleBundle\HttpFoundation\StreamResponse; | |
class MyController extends ContainerAware | |
{ | |
public function indexAction() | |
{ | |
// Call your client | |
$client = $this->get('csa_guzzle.client.my_client'); | |
$response = $client->get('/path/to/my/file.zip'); | |
return new StreamResponse($response); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment