|
| 1 | +# File structure |
| 2 | + |
| 3 | +Dotkernel Admin follows the [PSR-4](https://www.php-fig.org/psr/psr-4/) standards. |
| 4 | + |
| 5 | +It is considered good practice to standardize the file structure of projects. |
| 6 | + |
| 7 | +When using Dotkernel Admin the following structure is installed by default: |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +## Main directories |
| 12 | + |
| 13 | +* `bin` - Executable files from CLI |
| 14 | +* `config` - Various configuration files |
| 15 | +* `data` - Should contain project-related data (AVOID storing sensitive data on VCS) |
| 16 | +* `log` - Storage of log files generated by dot-error-log library |
| 17 | +* `public` - Publicly visible files. The webserver need to have this folder as www-document root folder. |
| 18 | +* `src` - Should contain the source code files |
| 19 | +* `test` - Should contain the test files |
| 20 | + |
| 21 | +## Special purpose folders |
| 22 | + |
| 23 | +* `.github` - Contains workflow files |
| 24 | +* `.laminas-ci` - Contains laminas-ci workflow files |
| 25 | + |
| 26 | +## `src` directory |
| 27 | + |
| 28 | +This directory contains all source code related to the Module. |
| 29 | +It should contain the following directories, if they are not empty: |
| 30 | + |
| 31 | +* Handler - Action classes (similar to Controllers but can only perform one action) |
| 32 | +* Entity - Database entities |
| 33 | +* Service - Service classes |
| 34 | +* Collection - Database entities collections |
| 35 | +* Repository - Entity repository folder |
| 36 | + |
| 37 | +> The above example lists just a part of the directories in a project, but it should give you an idea of what the structure should look like. |
| 38 | +
|
| 39 | +Other classes in the `src` directory may include `InputFilter`, `EventListener`, `Helper`, `Command`, `Factory` etc. |
| 40 | + |
| 41 | +The `src` directory should also contain 2 files: |
| 42 | + |
| 43 | +* `ConfigProvider.php` - Provides configuration data |
| 44 | +* `RoutesDelegator.php` - Module main routes entry file |
| 45 | + |
| 46 | +## `templates` directory for modules |
| 47 | + |
| 48 | +This directory contains the template files, used for example to help render e-mail templates. |
| 49 | + |
| 50 | +> Dotkernel Admin uses `twig` as Templating Engine. |
| 51 | +> All template files have the extension `.html.twig`. |
| 52 | +
|
| 53 | +## `data` directory |
| 54 | + |
| 55 | +This directory contains project-related data, like cache and file uploads. |
| 56 | + |
| 57 | +We recommend using the following directory structure: |
| 58 | + |
| 59 | +* `data/cache` - Location where caches are stored |
| 60 | +* `data/doctrine` - Fixtures and migrations |
| 61 | +* `data/lock` - Lock files generated by [dotkernel/dot-cli](https://docs.dotkernel.org/dot-cli/v3/lock-files/) |
0 commit comments