Closed girishpadia closed 4 years ago
@giansalex that kind of thing is usually best handled by your web-server. Are you sure you want PHP to proxy static resources?
Thank you for response. OK I will handle through web server. I thought to serve everything through routing. :+1:
That's a task that would put extra load on the PHP-FPM worker pool (assuming you're using FPM) if handled by PHP, which is rather unnecessary since webservers can already do that extremely well.
However, if you do need to have extra logic (e.g. an authorisation layer) you may choose to have PHP doing that too. That does go beyond the scope of this library since it's about routing and not serving responses. In that case, you'd implement a handler that would open the file resources via PHP and stream them as the response content - but, again, that's something you implement yourself or (better) use a "micro-framework" like Mezzio or SlimPHP to help you with.
Will close this then, glad to hear the webserver approach is enough for you :+1:
I want to serve some static contents like "index.html" but couldn't find any working example for this. Could you please guide?