ElPiter ElPiter - 19 days ago 5x
PHP Question

Symfony2 - How to check if we are being called from a mobile device

Using Symfony2, I need to check in the controller wether I am being called from a mobile device or from a desktop web browser.

Depending on the origin of the request, render different twig templates according to the screen sizes and conditions.

What would be a good approach to do this? What do we have in the Controller to check this?


I'm sure Symfony has some wrapped command to do this as well but:


will give you the user-agent string which tents to have a string "Android verNum".