-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: how to properly download file from the server with FlightPHP #600
Comments
Does this example help you out in the streaming portion of the docs? https://docs.flightphp.com/learn/routing#streaming |
Thanks for your quick feedback. I did not know it was possible to stream files :). Unfortunately, I am using wildcards in my GET router because I have hundreds of routes, so I could not use the callback. I will try to submit a PR for a helper function to download files later this week. |
Could you give me a pseudo code example of your codebase and how you're trying to do it? Maybe there's another way? |
Actually, what I wish for is a simple way to handle files, as easy as using I use a customized Kernel to load Controllers based on the route, so that I do not need to bother with registering all the routes (my app has several hundred). Basically, it looks like this: Flight::route('GET|POST|PUT|DELETE|PATCH /@module/@name(/@id(/@sub_name(/@line)))', function($module, $name, $id, $sub_name, $line){
$request = Flight::request();
$kernel = new App\Kernel();
$kernel->handle($request);
}); I created a PR for this if you think this idea is interesting. |
As the PR is now merged, I close this issue, thanks. |
Hello,
I am sorry for this trivial question, but I wonder what is the cleanest way to download a file from an end-point with FightPHP? I could not see anything related in the documentation.
Currently, I am doing as shown below, but in the same way that Symfony has
BinaryFileResponse
, maybe it would be better to have something similar?So far
The text was updated successfully, but these errors were encountered: