Skip to content

Instantly share code, notes, and snippets.

@csarrazi
Created July 9, 2015 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csarrazi/14b2e686966852e62d4e to your computer and use it in GitHub Desktop.
Save csarrazi/14b2e686966852e62d4e to your computer and use it in GitHub Desktop.
Stream a file using a StreamResponse
<?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