ElPiter ElPiter - 1 year ago 64
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?

Answer Source

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".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download