Your question is relevant and the same, for me, is more about form and not about how.
I put a question that I recommend reading:
MVC and change language dynamics
I can speak from experience that we should use a framework that implements an MVC for any of our PHP projects. I will not put the reasons here because it goes beyond the scope of the question, but it is certain that some already give some logic to control languages.
For those like me who professionally use their own framework and implement an MVC of their own and for various reasons are forced to find mechanisms to solve various problems. Language control is a problem to always be aware of.
Get the browser language.
It is a practice to adopt. In this way we are already following the definitions that the own browser with own mechanisms ensures and that it delivers us of tray.
This may not be enough for some projects, however, and again from experience, a functional language change is desired while using it, or because someone locks access to the settings of a browser for example. But by default getting the language from the browser is clearly the way to go.
From this point, I think that manipulating a URL amigável
to set a language is a simple, effective and very straightforward solution in a PHP project and beyond.
normal access:
www.meuprojecto.com/[controlador]/[acção]/[parametros]
obtem as configurações do browser
access that affects the language:
www.meuprojeto.com/pt/[controlador]/[acção]/[parametros]
força o idioma a ser pt "por exemplo"
With this approach the links are spread throughout the project and you can change the language at any time.
The methodology for saving the selected language depends on your solution but COOKIE recording may be one of them.