Is this the right way to structure MVC (understanding derived from teresko posts) + incorporate multilingual support in the structure?

REALLY UNDERSTAND MVC?

I read a lot of posts from teresko user and I think that I finally understand the real concept of modern MVC. I made a diagram of how I understand this, I hope that someone can confirm this for me and that, perhaps, this diagram will help some other users.

MY PLANNED "SMART" DIRECTORY STRUCTURE?

. , / . 4 . 3 , data_mappers, domain_objects services. 2 , . , lib 3 , , ( , ?). , , config ( - , ). . , , , / , , , .. .

, MVC?

( , MVC, , , , - )

, . , en fr, en fr - , www.mywebsite.com/ru/home , www.mywebsite.com/fr/home .

, en fr. 2- $_SESSION. $_SESSION, , . -. MVC ?

, , URL- ? : "/presentation/views/news/news.php" : "/pre sentation/views/news_nouvelles/news.php ", (URL- - , ;) " _ " , URL-, , url. , , , , , , / .

0
1

, MVC. URL-, .

Routing

, , , , URL- - .

$request = new Request($query);

$router = new Router;
$router->import('/path/to/routes.json');
$router->route( $request );

( : '/presentation/view/dernières/nouvelles') .

, , , , :

/presentation[[/:action[/:filter]]/:resource]

:

resource   >> 'nouvelles'
action     >> 'view'
filter     >> 'dernières'

, - . factory , , :

$normalizer = new Normalizer( $serviceFactory->create('translation') );
$normalizer->adjust($request);

, ,

  • translation ,
  • language,
  • title,

, , :

 translation  |  language  |  label
-------------------------------------
 view         |  en        |  view
 dernières    |  fr        |  latest
 nouvelles    |  fr        |  news

:, , SQL-, .. WHERE translation IN ( <the list> ), . >

:

  • , /,
  • ,

Request language .

. , , . Accepted-Language , .

my 2 cents

+5

Source: https://habr.com/ru/post/1540018/


All Articles