PHPackages                             nowo-tech/controller-kit-bundle - 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. nowo-tech/controller-kit-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

nowo-tech/controller-kit-bundle
===============================

Controller utilities for Symfony: redirectToReferer (configurable default route) and SafeForwardTrait for safe request forwarding.

02PHPCI failing

Since Mar 27Pushed 5d agoCompare

[ Source](https://github.com/nowo-tech/ControllerKitBundle)[ Packagist](https://packagist.org/packages/nowo-tech/controller-kit-bundle)[ RSS](/packages/nowo-tech-controller-kit-bundle/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Controller Kit Bundle
=====================

[](#controller-kit-bundle)

[![CI](https://github.com/nowo-tech/ControllerKitBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/nowo-tech/ControllerKitBundle/actions/workflows/ci.yml) [![Packagist Version](https://camo.githubusercontent.com/f1a618afb44b01e078cb1fd65f2bf632072796c49b8fea6e85aa694fb36ecab8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f776f2d746563682f636f6e74726f6c6c65722d6b69742d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/nowo-tech/controller-kit-bundle) [![Packagist Downloads](https://camo.githubusercontent.com/f7bf72a0b6c608ef6cd67c7195587ad10364bef7e073f62d4557d0c6bef63f11/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f776f2d746563682f636f6e74726f6c6c65722d6b69742d62756e646c652e737667)](https://packagist.org/packages/nowo-tech/controller-kit-bundle) [![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE) [![PHP](https://camo.githubusercontent.com/8e58b490725ac49cc8e463c473173681b324c9d92d7854275a785db013ca3de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f6c6f676f3d706870)](https://php.net) [![Symfony](https://camo.githubusercontent.com/3db9767565eebe4677a1af36a4a41db55f2d39a9b66ba0bb63a3ca290941c15d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d36253242253230253743253230372e34253230253743253230382e30253230253743253230382e312532422d3030303030303f6c6f676f3d73796d666f6e79)](https://symfony.com) [![GitHub stars](https://camo.githubusercontent.com/8da0d3c87abeade8a6da07d8c362320112e4ad76a6455308251a89f8308e1d73/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e6f776f2d746563682f636f6e74726f6c6c65722d6b69742d62756e646c652e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/nowo-tech/ControllerKitBundle) [![Coverage](https://camo.githubusercontent.com/cd0704b56f1d56def350b6d0164316307bb2f47834225fd85443b6fb0059bc73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d3130302532352d627269676874677265656e)](#tests-and-coverage)

> ⭐ **Found this useful?** [Install from Packagist](https://packagist.org/packages/nowo-tech/controller-kit-bundle) · Give it a **star** on [GitHub](https://github.com/nowo-tech/ControllerKitBundle) so more developers can find it.

**Controller Kit Bundle** — Utilities for Symfony controllers: **redirectToReferer** (configurable default route) and **SafeForwardTrait** for safe request forwarding. Tested on Symfony **7.4**, **8.0**, and **8.1** (also compatible with Symfony 6.x and 7.0–7.3) · PHP 8.1+ (Symfony 8.x requires PHP 8.4+).

Features
--------

[](#features)

- **RedirectToRefererTrait** — Redirect to the HTTP Referer when valid (same app, route exists), or to a configurable default route. 100% configurable via `nowo_controller_kit.default_route`.
- **SafeForwardTrait** — Forward to another controller method with a check that the method exists (avoids runtime errors).

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

[](#installation)

```
composer require nowo-tech/controller-kit-bundle
```

With **Symfony Flex**, the recipe registers the bundle and adds config. Without Flex, see [docs/INSTALLATION.md](docs/INSTALLATION.md).

**Manual registration** in `config/bundles.php`:

```
return [
  // ...
  Nowo\ControllerKitBundle\NowoControllerKitBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

In `config/packages/nowo_controller_kit.yaml`:

```
nowo_controller_kit:
  default_route: homepage  # Route used when redirectToReferer has no valid Referer
```

Use your own route name (e.g. `app_home`, `dashboard`).

Usage
-----

[](#usage)

### redirectToReferer

[](#redirecttoreferer)

Use the trait in a controller that extends `AbstractController`:

```
use Nowo\ControllerKitBundle\Controller\RedirectToRefererTrait;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;

class MyController extends AbstractController
{
  use RedirectToRefererTrait;

  public function submit(Request $request): Response
  {
    // ... handle form ...
    return $this->redirectToReferer($request);
    // Optional: merge params and set status
    // return $this->redirectToReferer($request, ['success' => 1], 303);
  }
}
```

When the request has a valid `Referer` header whose path matches a route in your app, the user is redirected there (with path and query params preserved). Otherwise they are redirected to the configured `default_route`.

### safeForward

[](#safeforward)

Use the trait in any controller that has `forward()` (e.g. `AbstractController`):

```
use Nowo\ControllerKitBundle\Controller\SafeForwardTrait;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class ApiController extends AbstractController
{
  use SafeForwardTrait;

  public function delegate(): Response
  {
    return $this->safeForward(
      OtherController::class,
      'actionName',
      ['id' => 123],
      ['page' => 1]
    );
  }
}
```

If `OtherController::actionName` does not exist, a `BadMethodCallException` is thrown instead of a generic error.

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

[](#documentation)

- [Installation](docs/INSTALLATION.md)
- [Configuration](docs/CONFIGURATION.md)
- [Usage](docs/USAGE.md)
- [Contributing](docs/CONTRIBUTING.md)
- [Changelog](docs/CHANGELOG.md)
- [Upgrading](docs/UPGRADING.md)
- [Release](docs/RELEASE.md)
- [Security](docs/SECURITY.md)
- [Engram](docs/ENGRAM.md)
- [Spec-driven development](docs/SPEC-DRIVEN-DEVELOPMENT.md)

### Additional documentation

[](#additional-documentation)

- [Demo (FrankenPHP)](docs/DEMO-FRANKENPHP.md)

Requirements
------------

[](#requirements)

- PHP `>=8.1` (&lt;8.6); **Symfony 8.0** and **8.1** require **PHP 8.4+**
- Symfony **7.4**, **8.0**, or **8.1** (minimum supported minors; also works on Symfony 6.x and 7.0–7.3 via `composer.json` constraints)
- For traits: `symfony/framework-bundle` in your application (AbstractController)

Development
-----------

[](#development)

```
make up
make install
make test
make cs-check
make phpstan
make release-check
```

Demo
----

[](#demo)

- `demo/symfony7` — Symfony **7.4**, host port **8010** by default (`PORT` in `.env`)
- `demo/symfony8` — Symfony **8.1** (PHP 8.4+), host port **8011** by default

Each demo runs **FrankenPHP + Caddy** in Docker. **`docker-compose`** sets **`APP_ENV=dev`** and mounts **`Caddyfile.dev`**, so PHP runs **without** long-lived workers (changes visible on refresh). **Worker mode** is the production Caddyfile path — see [docs/DEMO-FRANKENPHP.md](docs/DEMO-FRANKENPHP.md).

Global demo commands: `make -C demo help` (e.g. `make -C demo up-symfony8`).

Tests and coverage
------------------

[](#tests-and-coverage)

- Tests: PHPUnit (PHP)
- PHP: 100%

License and author
------------------

[](#license-and-author)

MIT · [Nowo.tech](https://nowo.tech) · [Héctor Franco Aceituno](https://github.com/HecFranco)

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance65

Regular maintenance activity

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 77.8% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e7947bfc3f2ce9574a18a2c60f3d95b5d1b0740e65dc929332c92f1df21f75ab?d=identicon)[HecFranco](/maintainers/HecFranco)

---

Top Contributors

[![HecFranco](https://avatars.githubusercontent.com/u/24323276?v=4)](https://github.com/HecFranco "HecFranco (7 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

### Embed Badge

![Health badge](/badges/nowo-tech-controller-kit-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nowo-tech-controller-kit-bundle/health.svg)](https://phpackages.com/packages/nowo-tech-controller-kit-bundle)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M829](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[pinguo/php-msf

Pinguo Micro Service Framework For PHP

1.7k4.2k](/packages/pinguo-php-msf)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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