Home >Backend Development >PHP Tutorial >How to organize and implement Laravel5.1 three-tier structure directory

How to organize and implement Laravel5.1 three-tier structure directory

WBOY
WBOYOriginal
2016-08-08 09:07:011289browse

As the title says, I have been learning laravel recently, but I found that many video tutorials only talk about the directory structure of Model and Controller, but I think it is easier to manage and maintain with Dao and Service similar to Java, but I don’t know how to organize it as a newbie. , and I plan to apply Laravel to my new project, does anyone know about it

Reply content:

As the title says, I have been learning laravel recently, but I found that many video tutorials only talk about the directory structure of Model and Controller, but I think it is easier to manage and maintain with Dao and Service similar to Java, but I don’t know how to organize it as a newbie. , and I plan to apply Laravel to my new project, does anyone know about it

Because the tutorial is just a code example and does not involve complex business logic.

PHP is currently not the best solution for large-scale projects. The main purpose is to be short and fast, so MVC is basically enough, and related logic processing is generally integrated into the Model layer.

If your business logic is quite complex and you don’t want the Model class to expand too much, you can also separate the business logic. It is generally recommended to create a related Repository class. The tutorial is here: https://laravel.com/docs/5.2 /...

PS: Code organization is all about finding a balance among changes, so it is still important to have an IDE for reconstruction

I also created related Repository

Reference: https://github.com/bestmomo/l...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn