PHPackages                             symplify/controller-autowire - 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. symplify/controller-autowire

Abandoned → [symfony/dependency-injection](/?search=symfony%2Fdependency-injection)Library[Framework](/categories/framework)

symplify/controller-autowire
============================

Adds support to autowire controller constructor without pain.

v1.4.10(9y ago)2520.6k↓23.3%3PHPPHP ^7.1

Since Nov 30Pushed 4y ago2 watchersCompare

[ Source](https://github.com/deprecated-packages/ControllerAutowire)[ Packagist](https://packagist.org/packages/symplify/controller-autowire)[ RSS](/packages/symplify-controller-autowire/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (12)Versions (48)Used By (0)

Controller Autowire - Deprecated, in core of Symfony 3.3+
=========================================================

[](#controller-autowire---deprecated-in-core-of-symfony-33)

- [symfony/symfony#22157](https://github.com/symfony/symfony/pull/22157)
- [symfony/symfony#21289](https://github.com/symfony/symfony/pull/21289)

---

[![Build Status](https://camo.githubusercontent.com/01e2e74e5044b68f74e06336205cbe6de95d77bf3878f6d07322e1e45efe8545/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f53796d706c6966792f436f6e74726f6c6c65724175746f776972652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Symplify/ControllerAutowire)[![Code Coverage](https://camo.githubusercontent.com/f8ace3595c564d46f6f7741b80f67e163c7dc10c427b7f37ec983f6812ee571d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f53796d706c6966792f436f6e74726f6c6c65724175746f776972652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Symplify/ControllerAutowire)[![Downloads](https://camo.githubusercontent.com/770273477086a04c93bd7f1252e86ebaf8d78c26314f8173d7b84a73129d8d66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d706c6966792f636f6e74726f6c6c65722d6175746f776972652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/symplify/controller-autowire)

This bundle does only 2 things. But does them well:

- **1. registers controllers as services and**
- **2. enables constructor autowiring for them**

Still wondering **why use controller as services**? Check [this](http://richardmiller.co.uk/2011/04/15/symfony2-controller-as-service) and [this](http://php-and-symfony.matthiasnoback.nl/2014/06/how-to-create-framework-independent-controllers/) article.

Install
-------

[](#install)

```
composer require symplify/controller-autowire
```

Add bundle to `AppKernel.php`:

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new Symplify\ControllerAutowire\SymplifyControllerAutowireBundle(),
            // ...
        ];
    }
}
```

Usage
-----

[](#usage)

```
class SomeController
{
    private $someClass;

    public function __construct(SomeClass $someClass)
    {
        $this->someClass = $someClass;
    }
}
```

Used to FrameworkBundle's controller? Use helpers traits!
---------------------------------------------------------

[](#used-to-frameworkbundles-controller-use-helpers-traits)

Inspired by [pull](https://github.com/symfony/symfony/pull/18193) [requests](https://github.com/symfony/symfony/pull/20493) to Symfony and setter injection that are currently on-hold, **here are the traits you can use right now**:

```
use Symplify\ControllerAutowire\Controller\Routing\ControllerAwareTrait;

final class SomeController
{
    use ControllerAwareTrait;

    public function someAction()
    {
        $productRepository = $this->getDoctrine()->getRepository(Product::class);
        // ...

        return $this->redirectToRoute('my_route');
    }
}
```

### Do you prefer only traits you use?

[](#do-you-prefer-only-traits-you-use)

```
use Symplify\ControllerAutowire\Controller\Routing\ControllerRoutingTrait;

final class SomeController
{
    use ControllerRoutingTrait;

    public function someAction()
    {
        return $this->redirectToRoute('my_route');
    }
}
```

Just type `Controller*Trait` in your IDE to autocomplete any of these traits.

That's all :)

Contributing
------------

[](#contributing)

Send [issue](https://github.com/Symplify/Symplify/issues) or [pull-request](https://github.com/Symplify/Symplify/pulls) to main repository.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 98.6% 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 ~11 days

Total

46

Last Release

3308d ago

Major Versions

v0.2.2 → v1.0.02016-07-18

v1.4.10 → v2.0.0-RC12017-04-14

PHP version history (4 changes)v0.0.1PHP ~5.6|~7.0

v0.1.1PHP ~7.0

v1.3.3PHP ^7.0

v1.4.0PHP ^7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/924196?v=4)[Tomas Votruba](/maintainers/TomasVotruba)[@TomasVotruba](https://github.com/TomasVotruba)

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (68 commits)")[![payamb](https://avatars.githubusercontent.com/u/4225687?v=4)](https://github.com/payamb "payamb (1 commits)")

---

Tags

autowiringcontrollerdependency-injectionphpphp71symfonysymplify

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/symplify-controller-autowire/health.svg)

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

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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