0
I am creating a MVC project in PHP and I was wondering how to create the structure of the folders correctly. I made a folder template based on the projects I found on Github but I don’t know if it’s the best way.
0
I am creating a MVC project in PHP and I was wondering how to create the structure of the folders correctly. I made a folder template based on the projects I found on Github but I don’t know if it’s the best way.
6
Mano basically, for a project structure that follows the MVC Standard, you could have basically 3 directories: Model
, View
and Controller
. Each folder must contain the responsibility files to which it refers... It is very common for these 3 directories to be inside a parent directory called src(source)
which is at the root of the project. At the root there may be other directories like Public
, which will contain the files that will be exposed to the Web, there may also be some configuration files like bootstrap.php
or composer.json
(if use and recommend to use).
Basically it could look like this:
projeto-php
├── bootstrap.php
├── composer.json
├── config
├── public
│ └── index.php
├── src
│ ├── Controller
│ ├── Model
│ ├── Services
│ └── View
└── vendor
Browser other questions tagged php html css
You are not signed in. Login or sign up in order to post.
Only in this image already lack pattern in my view, the folder names one so lower case, image folder outside the set css, js good really the organization of folders is important but, also the nomenclature.
– novic
sure I’ll pay attention to it, but how much the folder structure can help me ?
– Reignomo
I think it might be
App -> Controller
andApp -> Model
andApp -> View
andApp -> Public
andApp -> Vendor
to start.– novic
If I’m not mistaken, the briefcase
vendor
, created by Composer, the name is strictly lowercase.– Gabriel Heming
Make sure you use the nomenclatures correctly. Regardless of the name you put, you must follow upper and lower case when including the files in these folders. A
vendor
should be lowercase, as Composer himself already creates. Remember: the Windows file system is case-insensitive. Linux does not!– LipESprY
Could someone pass me a project link with a similar structure that is correct ?
– Reignomo
There is no correct structure. You structure the way you meet your needs, not those of others. Comparing it to one-off projects won’t do you any good.
– Woss