File structure

Dotkernel Frontend follows the PSR-4 standards.

It is a good practice to standardize the file structure of projects.

When using DotKernel Frontend the following structure is installed by default:

Dotkernel Frontend File Structure!

Main directories

  • bin - Executable files from CLI
  • config - Various configuration files
  • data - Should contain project-related data (AVOID storing sensitive data on VCS)
  • documentation - Should contain project-related documentation
  • log - Storage of log files generated by dot-error-log library
  • public - Publicly visible files. The webserver need to have this folder as www-document root folder.
  • src - Should contain the source code files
  • test - Should contain the test files

Special purpose folders

  • .github - Contains workflow files
  • .laminas-ci - Contains laminas-ci workflow files

src directory

This directory contains all source code related to the Module. It should contain the following directories, if they’re not empty:

  • Handler - Action classes (similar to Controllers but can only perform one action)
  • Entity - Database entities
  • Service - Service classes
  • Collection - Database entities collections
  • Repository - Entity repository folder

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.

Other classes in the src directory may include InputFilter, EventListener, Helper, Command, Factory etc.

The src directory should also contain 2 files:

  • ConfigProvider.php - Provides configuration data
  • RoutesDelegator.php - Module main routes entry file

templates directory

This directory contains the template files, used for example to help render e-mail templates.

DotKernel Frontend uses twig as Templating Engine. All template files have the extension .html.twig.

data directory

This directory contains project-related data, like cache and file uploads.

We recommend using the following directory structure:

  • data/cache - Location where caches are stored
  • data/doctrine - Fixtures and migrations
  • data/lock - Lock files generated by dotkernel/dot-cli