PHPackages                             dkplus/action-arguments - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dkplus/action-arguments

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dkplus/action-arguments
=======================

Provides the ability to use variable action arguments.

1.0(12y ago)350MITPHP

Since Nov 17Pushed 12y ago1 watchersCompare

[ Source](https://github.com/UFOMelkor/DkplusActionArguments)[ Packagist](https://packagist.org/packages/dkplus/action-arguments)[ RSS](/packages/dkplus-action-arguments/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (17)Versions (3)Used By (0)

DkplusActionArguments
=====================

[](#dkplusactionarguments)

[![Build Status](https://camo.githubusercontent.com/c58b9096ef46a9c1461431083ac17aa6b336d5cbb97539448d66f5d57c3efd91/68747470733a2f2f7472617669732d63692e6f72672f55464f4d656c6b6f722f446b706c7573416374696f6e417267756d656e74732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/UFOMelkor/DkplusActionArguments)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/b70d471269140f2e90d8f36e37a74a856a60a9e8a4d8d3895609270e724a8da8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f55464f4d656c6b6f722f446b706c7573416374696f6e417267756d656e74732f6261646765732f7175616c6974792d73636f72652e706e673f733d61396539636266613031356664363738323861633134366539636666646239363039646230656364)](https://scrutinizer-ci.com/g/UFOMelkor/DkplusActionArguments/)[![Coverage Status](https://camo.githubusercontent.com/24c615e770aa30be0d72a97cbf9a84fe354f6c6d90c1046720ed726f1f3277a9/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f55464f4d656c6b6f722f446b706c7573416374696f6e417267756d656e74732f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/UFOMelkor/DkplusActionArguments)[![Total Downloads](https://camo.githubusercontent.com/c83d66d3ffb07504904f65ba6517d9724646d77dd6e9e1ccadc5a8258aaeadde/68747470733a2f2f706f7365722e707567782e6f72672f646b706c75732f616374696f6e2d617267756d656e74732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/dkplus/action-arguments)[![Latest Stable Version](https://camo.githubusercontent.com/197e8840ba70d64626ec628a4765df389c1fc0ca5ab0b126091b1e1aee62ce7b/68747470733a2f2f706f7365722e707567782e6f72672f646b706c75732f616374696f6e2d617267756d656e74732f762f737461626c652e706e67)](https://packagist.org/packages/dkplus/action-arguments)[![Latest Unstable Version](https://camo.githubusercontent.com/ef64975d6079875bc6f880abaf59b7eb67a3082e00462da31a9a591c5a7bcce1/68747470733a2f2f706f7365722e707567782e6f72672f646b706c75732f616374696f6e2d617267756d656e74732f762f756e737461626c652e706e67)](https://packagist.org/packages/dkplus/action-arguments)[![Dependency Status](https://camo.githubusercontent.com/a95a4b1e811d56419b25a874e4e5fc66cb58476437c5d386d0767574d15541a8/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3532373139646436363332626163373166653030303134362f62616467652e706e67)](https://www.versioneye.com/user/projects/52719dd6632bac71fe000146)

- [Features](#features)
- [Examples](#examples)
- [Installation](#installation)
- [ToDo](#todo)

Features
--------

[](#features)

- Provides named arguments from route match. ([Example 1](#named-scalar-arguments))
- Can convert scalar arguments into classes.
- Has built in support for Doctrine ORM ([Example 2](#simplest-converting-by-using-doctrine-objectrepositoryfind), [Example 3](#converting-by-using-a-custom-doctrine-objectrepository-method)), but also usable with every other mapping solution by using callbacks ([Example 4](#converting-by-using-a-callback), [Example 5](#converting-by-using-a-custom-converter)).
- Supports optional arguments.
- When one argument could not be mapped into an entity, a 404 error page could be shown.
- If your assertions can be retrieved from the service locator, the arguments could be injected into your assertions; that way you could improve your controller-/route-guards with better assertions.

### Examples

[](#examples)

#### Named scalar arguments

[](#named-scalar-arguments)

```
use DkplusActionArguments\Controller\AbstractActionController;

class IndexController extends AbstractActionController
{
    /**
     * Route looks like /user/:id
     */
    public function viewAction($id)
    {
        return array('user' => $this->mapper->find($id));
    }
}
```

#### Simplest converting by using Doctrine ObjectRepository::find

[](#simplest-converting-by-using-doctrine-objectrepositoryfind)

```
use DkplusActionArguments\Controller\AbstractActionController;

class IndexController extends AbstractActionController
{
    /**
     * Route looks like /user/:user
     */
    public function viewAction(User $user)
    {
        return array('user' => $user);
    }
}
```

#### Converting by using a custom Doctrine ObjectRepository method

[](#converting-by-using-a-custom-doctrine-objectrepository-method)

```
use DkplusActionArguments\Annotation\MapParam;
use DkplusActionArguments\Controller\AbstractActionController;

class IndexController extends AbstractActionController
{
    /**
     * Route looks like /user/:name
     * @MapParam(from="name", to="user", using="findOneByName")
     */
    public function viewAction(User $user)
    {
        return array('user' => $user);
    }
}
```

#### Converting by using a callback

[](#converting-by-using-a-callback)

```
use DkplusActionArguments\Annotation\MapParam;
use DkplusActionArguments\Controller\AbstractActionController;

class IndexController extends AbstractActionController
{
    /**
     * Route looks like /user/:user
     * @MapParam(to="user", using={"sm_key", "method"})
     */
    public function viewAction(User $user)
    {
        return array('user' => $user);
    }
}
```

#### Converting by using a custom converter

[](#converting-by-using-a-custom-converter)

```
use DkplusActionArguments\Annotation\MapParam;
use DkplusActionArguments\Controller\AbstractActionController;

class IndexController extends AbstractActionController
{
    /**
     * Route looks like /user/:user
     * @MapParam(to="user", using="my_converter_sm_key")
     */
    public function viewAction(User $user)
    {
        return array('user' => $user);
    }
}
```

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

[](#installation)

Installation of this module uses composer. For composer documentation, please refer to [getcomposer.org](http://getcomposer.org/).

`php composer.phar require dkplus/action-arguments`

When asked for a version to install, type `dev-master`. You can then enable it in your `config/application.config.php`by adding `DkplusActionArguments` to your modules.

After installing copy `config/dkplus-action-arguments.global.php.dist` to `application/autoload/dkplus-action-arguments.global.php`.

ToDo
----

[](#todo)

- Init named arguments
- Add Argument converter
- Support for BjyAuthorize, SpiffyAuthorize, ZfcRbac
- Better documentation
- Add tests for BjyAuthorize-, SpiffyAuthorize and ZfcRbac-Support
- Find proper class names
- Reduce code complexity
- Clear cache via console.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~72 days

Total

2

Last Release

4537d ago

Major Versions

0.1 → 1.02014-01-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/332fa213a52cc7607fb381af6d196f51f073f97ebdb113e4db9bde55663018ce?d=identicon)[\[-UFO-\]Melkor](/maintainers/[-UFO-]Melkor)

---

Top Contributors

[![UFOMelkor](https://avatars.githubusercontent.com/u/571106?v=4)](https://github.com/UFOMelkor "UFOMelkor (52 commits)")

---

Tags

parameterzf2controllerZend Frameworkargumentsactionguards

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dkplus-action-arguments/health.svg)

```
[![Health](https://phpackages.com/badges/dkplus-action-arguments/health.svg)](https://phpackages.com/packages/dkplus-action-arguments)
```

###  Alternatives

[zf-commons/zfc-base

A set of genetic (abstract) classes which are commonly used across multiple modules.

1491.1M25](/packages/zf-commons-zfc-base)

PHPackages © 2026

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