dotkernel / light
Dotkernel Light Application
Requires
- php: ~8.3.0 || ~8.4.0 || ~8.5.0
- dotkernel/dot-errorhandler: ^5.0.0
- laminas/laminas-component-installer: ^3.5.0
- laminas/laminas-config-aggregator: ^1.17.0
- mezzio/mezzio: ^3.24.0
- mezzio/mezzio-fastroute: ^3.13.0
- mezzio/mezzio-twigrenderer: ^2.17.0
Requires (Dev)
- filp/whoops: ^2.17.0
- laminas/laminas-coding-standard: ^3.0.1
- laminas/laminas-development-mode: ^3.13.0
- phpstan/phpstan: ^2.1.2
- phpstan/phpstan-phpunit: ^2.0.4
- phpunit/phpunit: ^12.5.23
- roave/security-advisories: dev-master
- symfony/var-dumper: ^7.2.3
- vincentlanglet/twig-cs-fixer: ^4.0.0
README
Dotkernel Light is the smallest complete Mezzio application — a PSR-15 pipeline, routing and templating, with nothing to strip out. A real starting point for a simple site. Underneath it uses Laminas Service Manager as the PSR-11 container and Laminas Diactoros for PSR-7 messages, with FastRoute for routing and Twig for templating.
Check out our demo.
Documentation
Documentation is available at: https://docs.dotkernel.org/light-documentation/
Badges
Contents
- Requirements
- Composer
- Choosing an Installation Path
- Installing Dotkernel
Light - Development Mode
- Bundling Static Modules
- Running the Application
- Testing and Code Quality
- Going Live
Requirements
- PHP 8.3, 8.4 or 8.5 (
~8.3.0 || ~8.4.0 || ~8.5.0). All three versions are covered by CI. - Node.js
^20.19.0 || >=22.12.0— required by the Vite and Sass versions used to build the interface.
npm ships bundled with Node.js, so any supported Node.js release provides a compatible npm.
The exact Node.js versions the interface is built against are defined by the matrix in
.github/workflows/build-assets.yml, which is the authoritative list.
The following paths must be writable by the user the web server runs as:
data/cache/— compiled Twig templates and the aggregated configuration cachelog/— application error logs
Composer
Installation instructions:
If you have never used composer before make sure you read the
Composer Basic Usagesection in Composer's documentation.
Choosing an Installation Path
Example:
- absolute path
/var/www/dk - or relative path
dk(equivalent with./dk)
Installing Dotkernel Light
After you choose the path for Dotkernel light (dk will be used for the remainder of this example), let's move onto installation.
Clone the repository into that path — git creates the directory for you:
git clone https://github.com/dotkernel/light.git dk
cd dk
This method ensures that the default branch is installed, even if it is not released.
The dependencies have to be installed separately by running this command:
composer install
During installation, the laminas/laminas-component-installer Composer plugin prompts for some configuration settings, for example the lines below:
Please select which config file you wish to inject 'Laminas\HttpHandlerRunner\ConfigProvider' into: [0] Do not inject [1] config/config.php Make your selection (default is 1):
Select [0] Do not inject.
Dotkernel registers the config providers it needs explicitly in config/config.php, so automatic injection is not required.
If you choose [1] config/config.php, the ConfigProvider will be appended to that file instead.
The next question is:
Remember this option for other packages of the same type? (Y/n)
You should enter y and press Enter, so you are not asked again for every remaining component.
This choice is remembered for all subsequent components, not just this one. If you later install a package whose
ConfigProviderdoes need to be registered, add it toconfig/config.phpyourself.
Finally, make sure your local configuration file exists:
cp config/autoload/local.php.dist config/autoload/local.php
A Composer hook normally creates this file for you, but it is registered on
post-update-cmdonly, so it does not run for installs performed from an existingcomposer.lock. The file is git-ignored and holds your local settings —application.urland the page routes are defined here and nowhere else.
Development Mode
Run this command to enable dev mode by turning debug flag to true and turning configuration caching to off.
It will also make sure that any existing config cache is cleared.
composer development-enable
Bundling Static Modules
Prerequisite software: Node.js
^20.19.0 || >=22.12.0
To install dependencies into the node_modules directory run this command.
npm install
If npm install fails, this could be caused by user permissions of npm.
We recommend installing npm through Node Version Manager.
You can skip the next step until you make changes in the
src/App/assetsfolder
The build command compiles the components from the src/App/assets folder into the public folder.
This command overwrites existing files in the
publicfolder.
npm run build
While actively working on the assets, this command rebuilds them on every change instead of requiring a manual rebuild:
npm run watch
Running the Application
For a quick look, PHP's built-in server is enough:
composer serve
The application is then available at http://localhost:8080.
For anything beyond that, we recommend running your applications in WSL:
- Make sure you have WSL installed on your system.
- Currently we provide a distro implementation for AlmaLinux10.
- Install the application in a virtualhost as recommended by the chosen distro.
The virtualhost document root must point to the
publicdirectory — the entry point ispublic/index.php— and never to the project root. - Set
$baseUrlin config/autoload/local.php to the address of your virtualhost. - Run the application by opening the virtualhost address in your browser.
You should see the Dotkernel Light welcome page.
NOTE:
- If you are getting exceptions or errors regarding some missing services, clear the configuration cache:
composer clear-config-cache
If
config-cache.phpis present that config will be loaded regardless of theConfigAggregator::ENABLE_CACHEinconfig/autoload/mezzio.global.php
Testing and Code Quality
Run every check at once — coding standard, Twig coding standard, static analysis and unit tests:
composer check
The individual commands are also available:
| Command | Purpose |
|---|---|
composer cs-check / composer cs-fix |
PHP coding standard (Laminas Coding Standard) |
composer twig-cs-check / composer twig-cs-fix |
Twig template coding standard |
composer static-analysis |
PHPStan, level 8 |
composer test |
PHPUnit test suite |
Going Live
Before deploying to production, rename the robots file and adjust it for your site:
mv public/robots.txt.dist public/robots.txt