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 2

    1. Do you use any design pattern? If yes, then the structure of such a project can be found on the Internet (I advise MVC).
    2. 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