Questions tagged [symfony-http-foundation]

Symfony is a set of reusable PHP components. The HttpFoundation component defines an object-oriented layer for the HTTP specification.

Symfony is a set of reusable PHP components. The HttpFoundation component defines an object-oriented layer for the HTTP specification.

Useful links

61 questions
16
votes
1 answer

Check whether parameter exists or not in the request

I have this function: /** * @Secure(roles="IS_AUTHENTICATED_FULLY") * @Route("/chequearFabricanteDistribuidor", name="chequearFabricanteDistribuidor", condition="request.headers.get('X-Requested-With') == 'XMLHttpRequest'") * @Method("GET") …
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
5
votes
1 answer

Laravel conditional View for https

I want to return a view from my controller function with https or http depending on a variable. I don't want to redirect it to https or http and I only want to use View::make() or Response::view() function. Is it possible? Example: public function…
5
votes
5 answers

How can I export a CSV using Symfony's StreamedResponse?

My code looks fine, I get status 200, I get the right headers, ... and yet my CSV file created will not donwload... There is no error, so I do not understand why it's failing. Here is my code: namespace Rac\CaraBundle\Manager; /* Imports */ use…
demenvil
  • 1,089
  • 1
  • 12
  • 25
4
votes
2 answers

Filtering on Nested Properties: dot to underscore redirect

I'm using Symfony and API Platform and I'd like to filter on nested properties. While this looks very simple, when I go to: http://localhost:8000/api/offers?product.color=red The request is redirected…
4
votes
1 answer

How do I retrieve basic auth credentials from Symfony's HttpFoundation component?

I want to retrieve the basic authentication credentials from Symfony's HttpFoundation component. A cursory look at the docs reveals nothing; is there a way I can do it? (I'm using the HttpFoundation component in an application not based on the…
user2064000
4
votes
1 answer

Sf2 RedirectResponse not working

I am using the HttpFoundation component in my project without using the full Symfony2 framework. I try to make a RedirectResponse if some credentials are true and redirect the user (like stated in the documentation), but the return statement is not…
Ivan
  • 5,139
  • 11
  • 53
  • 86
3
votes
1 answer

Laravel generates wrong route behind reverse proxy with path prefix

Running Laravel behind Traefik as reverse proxy, with a Path Prefix (eg /api/ => Laravel). Laravel is served by Nginx and Php-fpm. Laravel use Symfony HTTP foundation to generate route URL. Symfony is not seeing correctly the base path, and generate…
Thomas Decaux
  • 21,738
  • 2
  • 113
  • 124
3
votes
0 answers

Symfony Binary File Response fails at the end of the download process

I usually don't post any question on Stack Overflow because I always find an answer to whatever problem I'm in trouble with. But here, I haven't found a clear answer so if you can help me, thanks a lot ! I'm working on a Symfony 3.4 website. I've…
3
votes
0 answers

Where is ob_start in Response?

If I use $response->send() then this code is executed: public static function closeOutputBuffers($targetLevel, $flush) { $status = ob_get_status(true); $level = count($status); // PHP_OUTPUT_HANDLER_* are not defined on…
hapeb
  • 33
  • 2
3
votes
1 answer

How to correctly use silex "finish" middleware to process heavy operations in background?

I'm writing an app on Silex in accordance with the documentation but with some additions. I declare the route, after middleware for route and finish middleware for app. $app->put('/request/', function (Request $request) use ($app) { // ... some…
IvanMalenko
  • 427
  • 2
  • 13
3
votes
2 answers

new (Json)Response shows blank page (Symfony HttpFoundation)

I am using the HttpFoundation in my small project: use \Symfony\Component\HttpFoundation\JsonResponse as JsonResponse; Unfortunately all my responses (tried JsonResponse, Response and BinaryFileResponse) only return a blank page, no errors and the…
PrimuS
  • 2,505
  • 6
  • 33
  • 66
3
votes
2 answers

Making my own argument resolver for my my own PHP framework

I decided to make my own mini - framework for PHP that I am going to use for a real life job, creation of a Web Service for a social app. I got started with Fabien Potencier's guide to creating your own framework on top of the Symfony's components -…
3
votes
2 answers

Symfony2: force stop code execution after sendiing Response headers

What is the correct way to stop code execution after sending Response headers, but without using exit()? I know the script SHOULD return a Response, but how can I force it to be returned from outside of a Controller, for example from a service? Lets…
Jarek Jakubowski
  • 948
  • 10
  • 22
3
votes
1 answer

How many sessions Symfony app or PHP can manage at same time?

Lets said I have a Symfony2 app that shares two main bundles: OneBundle and TwoBundle. OneBundle acts as a backend for administration purposes and TwoBundle is a RESTful API for externals. Flow for OneBundle is the know for everyone: admin login,…
ReynierPM
  • 17,594
  • 53
  • 193
  • 363
1
2 3 4 5