Hello!
System - Classic LAMP
Will this structure work:
I. Project shared folder at: / var / www / project:
in her:
____ folder with js
____ folder with php
____ with html
____c css
Or is it wrong in terms of security?
The project is a children's game, most likely no one will hack, but I would like to correctly)))
Thank!
2 answers
- Do you use any design pattern? If yes, then the structure of such a project can be found on the Internet (I advise MVC).
- I usually create in this form.
--- | Public - everything that is available in essence to the user.
------ | Assets - js, css, fonts.
--------- | js
--------- | css
--------- | fonts
------ | views - views from where I attach files. html pages can be connected right there.
--- | Core - the software part. Classes, models and the like.
----- | Classes
--- | Configs - configuration files.
index.php - at the root. All requests here.
It is possible to do simple routing through $ _GET parameters without knowledge of .htaccess and complex design patterns. If you need a simple and fast project, then I am writing it that way. I can throw off the repository with an example, if you're interested.
- quick simple routing is done through the silex microframe, the twig template is included in the same place - Total Pusher
- @TotalPusher Silex - depracated.
Silex is in maintenance mode. Ends of life is set to June 2018. Use Symfony 4 instead.- silex.symfony.com/doc/2.0/changelog.html , symfony.com/blog/the-end-of-silex - jashka am - @jashka Sorry, I liked it - Total Pusher
- Yes! Come on! iesbk@bk.ru. I will be very grateful! - OO
- No, I do not use templates (while I read the big four how to do it correctly - OO
I wrote once a framework and made such a structure
As for the organization of security, then your application code should be outside the input file so that a ΡΠΌΠ΅Π»ΡΠΉ ΡΠ΅Π»ΠΎΠ²Π΅ΠΊ cannot directly link to the source
Input file public/index.php , code src/src and public at the same level
More symfony way but can get something for yourself
βββ app β βββ config β βββ logs βββ Framework β βββ Config β βββ Controller β βββ Database β βββ DI β βββ Event β βββ Exception β βββ Helper β βββ Logger β βββ Model β βββ Patterns β βββ Renderer β βββ Request β βββ Response β βββ Router β βββ Security β βββ Services β βββ Session β βββ Validation β βββ Filter βββ src β βββ CMS β β βββ config β β βββ Controller β β βββ Migrations β β βββ Model β β βββ views β βββ Shop β βββ config β βββ Controller β βββ Model β βββ Services β βββ views βββ storage β βββ session βββ web βββ css βββ fonts βββ images β βββ uploads βββ js βββ uploads - It turns out - is it MVC? That is, all communication with the site will occur through the input file and view files in the views folder? - OO
- @OO yes it is MVC, yes, but your folders may be different, but the entry point is one - jashka