PHPackages                             dotkernel/dot-controller - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. dotkernel/dot-controller

ActiveLibrary[Framework](/categories/framework)

dotkernel/dot-controller
========================

Dotkernel controller like middleware component with plugin support

4.2.0(6mo ago)223.5k↑186.1%310MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Mar 8Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/dotkernel/dot-controller)[ Packagist](https://packagist.org/packages/dotkernel/dot-controller)[ Docs](https://github.com/dotkernel/dot-controller)[ RSS](/packages/dotkernel-dot-controller/feed)WikiDiscussions 4.0 Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (28)Used By (10)

dot-controller
==============

[](#dot-controller)

This is Dotkernel's controller package that can be used like middleware inside Dotkernel or Mezzio application. It provides base classes for action-based controllers similar to a Laminas controller component. It is more lightweight, though, but supports controller plugins and event listeners.

Documentation
-------------

[](#documentation)

Documentation is available at: .

Badges
------

[](#badges)

[![OSS Lifecycle](https://camo.githubusercontent.com/99b3ce17444b704a1311ed639ab1ce5a3bff9a897f0293e1d0c283fdf86fa375/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d636f6e74726f6c6c6572)](https://camo.githubusercontent.com/99b3ce17444b704a1311ed639ab1ce5a3bff9a897f0293e1d0c283fdf86fa375/68747470733a2f2f696d672e736869656c64732e696f2f6f73736c6966656379636c652f646f746b65726e656c2f646f742d636f6e74726f6c6c6572)[![PHP from Packagist (specify version)](https://camo.githubusercontent.com/e87459e6c684b03d715ab0c5c0488833b5901dc714b91819ef84d6ddb0415e3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d636f6e74726f6c6c65722f342e322e30)](https://camo.githubusercontent.com/e87459e6c684b03d715ab0c5c0488833b5901dc714b91819ef84d6ddb0415e3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f646f746b65726e656c2f646f742d636f6e74726f6c6c65722f342e322e30)

[![GitHub issues](https://camo.githubusercontent.com/5412332dae47c38b839b356f222d7ef2033da5935a55ecb93016f921ea99ec25/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f646f746b65726e656c2f646f742d636f6e74726f6c6c6572)](https://github.com/dotkernel/dot-controller/issues)[![GitHub forks](https://camo.githubusercontent.com/95b7cf378267ec6abb04e1622d20c749aa6b810f5134d7ca6cc2415e3950515f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f646f746b65726e656c2f646f742d636f6e74726f6c6c6572)](https://github.com/dotkernel/dot-controller/network)[![GitHub stars](https://camo.githubusercontent.com/d4cce04ab840836798f30c4c5b1b00289ed5f15e57eab09463c739e61873b6cc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f646f746b65726e656c2f646f742d636f6e74726f6c6c6572)](https://github.com/dotkernel/dot-controller/stargazers)[![GitHub license](https://camo.githubusercontent.com/8d8ddc3dfe54283f5548477296cdd98c8fa0f7bba12b0470863586d4233a1314/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f646f746b65726e656c2f646f742d636f6e74726f6c6c6572)](https://github.com/dotkernel/dot-controller/blob/4.0/LICENSE.md)

[![Build Static](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml)[![codecov](https://camo.githubusercontent.com/ed6d09f93da065f5f7a630c63e623685dfcdb8c254897481468ebfc439ca7edf/68747470733a2f2f636f6465636f762e696f2f67682f646f746b65726e656c2f646f742d636f6e74726f6c6c65722f67726170682f62616467652e7376673f746f6b656e3d56554247354c4d34434b)](https://codecov.io/gh/dotkernel/dot-controller)[![PHPStan](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml)

Installation
------------

[](#installation)

Install `dot-controller` by executing the following Composer command:

```
composer require dotkernel/dot-controller
```

Usage
-----

[](#usage)

Middleware controllers act as a handler for multiple routes. Some conventions were made:

- register controllers in the `routes` array just like any Mezzio middleware. The requirement is that you should define an `action` route parameter (possibly optional) anywhere inside the route (e.g `/user[/{action}]`).
- action parameter value is converted to a method name inside the controller. Underscore, dot and line characters are removed and the action name is converted to a camel-case suffixed by the string `Action`. For example, a route and action pair like `/user/forgot-password` will be converted to method `forgotPasswordAction`.
- the default action value, if not present in the URI is `index`, so you should always define an `indexAction` within your controllers for displaying a default page or redirecting.

To create your action-based controllers, you must extend the abstract class `Dot\Controller\AbstractActionController`.

### Example

[](#example)

Creating a UserController with a default action and a register action. Will handle routes `/user` and `/user/register`.

```
use Dot\Controller\AbstractActionController;

class UserController extends AbstractActionController
{
    public function indexAction()
    {
        //...
    }

    public function registerAction()
    {
        //...
    }
}
```

Then register this controller as routed middleware in file `RoutesDelegator.php` just like regular middleware.

```
//Example from a RoutesDelegator
$app->route(
    '/user[/{action}]',
    UserController::class,
    [RequestMethodInterface::METHOD_GET, RequestMethodInterface::METHOD_POST],
    'user'
);
```

### Multiple controllers for the same route

[](#multiple-controllers-for-the-same-route)

**Use case:**You have defined a controller inside some package, with default actions. You want to add actions that fall into the same controller name (or route name more exactly). You want to do this without extending the controller provided by the package. In this case you can do the following:

- create your own controller, independent of the package's controller, which adds more actions
- Mezzio lets you define an array of middleware for a route, so you can register this controller before the package's controller

Now when a request for this route comes in, your controller will run first. Dotkernel controllers are designed to ignore requests that cannot be matched to one of its methods, so if no action matches, it will call the next middleware, in our case, the second controller. If this is the last controller, and the action does not match here, it will go to the default 404 Not found page (handled by NotFoundDelegate).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance66

Regular maintenance activity

Popularity32

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~117 days

Recently: every ~62 days

Total

28

Last Release

196d ago

Major Versions

0.3.1 → 1.0.02018-04-16

1.0.0 → v2.0.02020-01-30

2.0.x-dev → 3.0.02020-05-08

3.5.0 → 4.0.02025-01-14

3.0.x-dev → 4.0.x-dev2025-11-03

PHP version history (9 changes)0.1.0PHP ^7.1

v2.0.0PHP ^7.2

3.0.0PHP ^7.4

3.2.0PHP ^7.4 || ~8.0 || ~8.1

3.2.1PHP ^7.4 || ~8.0.0 || ~8.1.0

3.4.0PHP ~8.1.0 || ~8.2.0

3.4.3PHP ~8.1.0 || ~8.2.0 || ~8.3.0

4.0.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0

3.6.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1156873?v=4)[Dotkernel](/maintainers/dotkernel)[@dotkernel](https://github.com/dotkernel)

---

Top Contributors

[![n3vrax](https://avatars.githubusercontent.com/u/5805542?v=4)](https://github.com/n3vrax "n3vrax (36 commits)")[![alexmerlin](https://avatars.githubusercontent.com/u/4542449?v=4)](https://github.com/alexmerlin "alexmerlin (16 commits)")[![arhimede](https://avatars.githubusercontent.com/u/22009710?v=4)](https://github.com/arhimede "arhimede (10 commits)")[![gabidj](https://avatars.githubusercontent.com/u/3998573?v=4)](https://github.com/gabidj "gabidj (8 commits)")[![claurospace](https://avatars.githubusercontent.com/u/224870609?v=4)](https://github.com/claurospace "claurospace (6 commits)")[![Howriq](https://avatars.githubusercontent.com/u/63609103?v=4)](https://github.com/Howriq "Howriq (5 commits)")[![SergiuBota1](https://avatars.githubusercontent.com/u/50962867?v=4)](https://github.com/SergiuBota1 "SergiuBota1 (4 commits)")[![MarioRadu](https://avatars.githubusercontent.com/u/10761919?v=4)](https://github.com/MarioRadu "MarioRadu (1 commits)")[![OnitaAndrei](https://avatars.githubusercontent.com/u/57144858?v=4)](https://github.com/OnitaAndrei "OnitaAndrei (1 commits)")

---

Tags

pluginlaminasservice-managermezziocontroller

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dotkernel-dot-controller/health.svg)

```
[![Health](https://phpackages.com/badges/dotkernel-dot-controller/health.svg)](https://phpackages.com/packages/dotkernel-dot-controller)
```

###  Alternatives

[laminas/laminas-mvc

Laminas's event-driven MVC layer, including MVC Applications, Controllers, and Plugins

17224.4M365](/packages/laminas-laminas-mvc)[mezzio/mezzio

PSR-15 Middleware Microframework

3883.6M97](/packages/mezzio-mezzio)[laminas-api-tools/api-tools

Laminas API Tools module for Laminas

371.7M10](/packages/laminas-api-tools-api-tools)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)[laminas-api-tools/api-tools-oauth2

Laminas module for implementing an OAuth2 server

112.0M5](/packages/laminas-api-tools-api-tools-oauth2)[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
