PHPackages                             zlikavac32/symfony-extras - 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. [CLI &amp; Console](/categories/cli)
4. /
5. zlikavac32/symfony-extras

ActiveLibrary[CLI &amp; Console](/categories/cli)

zlikavac32/symfony-extras
=========================

Various extra functionality for Symfony

0.2.0(7y ago)22901MITPHPPHP ^7.2CI failing

Since Mar 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/zlikavac32/symfony-extras)[ Packagist](https://packagist.org/packages/zlikavac32/symfony-extras)[ RSS](/packages/zlikavac32-symfony-extras/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (8)Versions (3)Used By (1)

Symfony extras
==============

[](#symfony-extras)

[![Build Status](https://camo.githubusercontent.com/48d925d4d969b8b9e1a1d6c7aa1e6392a564a5a3b51142985a9026b7e801e27f/68747470733a2f2f7472617669732d63692e6f72672f7a6c696b6176616333322f73796d666f6e792d6578747261732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/zlikavac32/symfony-extras)

This repository adds a few extra functionality that I miss in the Symfony components. Functionality is currently only DIC and console related.

Table of contents
-----------------

[](#table-of-contents)

1. [Introduction](#introduction)
2. [Installation](#installation)
3. [Usage](#usage)
    1. [Runnable](#runnable)
    2. [Dynamic service decorators and service linker](#dynamic-service-decorators-and-service-linker)
    3. [Dynamic event dispatchers](#dynamic-event-dispatchers)
    4. [Dynamic composite services](#dynamic-composite-services)
4. [Examples](#examples)

Introduction
------------

[](#introduction)

Idea of this library is to use what you need. No dependency is explicitly required as no code is run by default. It provides few things, like various compiler passes to make a life a bit easier.

Compiler passes are all idempotent.

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

[](#installation)

Recommended installation is through Composer.

```
composer require zlikavac32/symfony-extras
```

Usage
-----

[](#usage)

Different concepts exist in this library.

### Runnable

[](#runnable)

[symfony/console](https://github.com/symfony/console) is a great package, but one can get into trouble when trying to decorate commands. This library defines `\Zlikavac32\SymfonyExtras\Command\Runnable\Runnable` interface which is then injected into `\Zlikavac32\SymfonyExtras\Command\Runnable\RunnableCommand`.

DIC compiler pass that automates this is provided in `\Zlikavac32\SymfonyExtras\DependencyInjection\Compiler\ConsoleRunnablePass`.

Read more about this concept in [docs/runnable.md](docs/runnable.md).

### Dynamic service decorators and service linker

[](#dynamic-service-decorators-and-service-linker)

Symfony provides out of the box service decoration, but it can get messy when there is to much decoration involved. This library offers two compiler passes to tackle that. First is `\Zlikavac32\SymfonyExtras\DependencyInjection\Compiler\DecoratorPass` and the second is `\Zlikavac32\SymfonyExtras\DependencyInjection\Compiler\ServiceLinkerPass`.

Idea is to define template services that are decorators, and then tag services that need decoration. Since certain decorators need other services or arguments, service linker is used to link services through tags.

Read more about this concept in [docs/dynamic-decorator.md](docs/dynamic-decorator.md) and [docs/linker.md](docs/linker.md).

### Dynamic event dispatchers

[](#dynamic-event-dispatchers)

Symfony provides `\Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass` to register event dispatchers. Compiler pass that can automate that process is provided in `\Zlikavac32\SymfonyExtras\DependencyInjection\Compiler\EventDispatcherPass`.

Read more about this concept in [docs/dynamic-event-dispatcher.md](docs/dynamic-event-dispatcher.md).

### Dynamic composite services

[](#dynamic-composite-services)

Certain services have composite nature in a sense that they require other services either in their constructor, or through method injection. Symfony provides solution in some degree through [tagged service injection](https://symfony.com/blog/new-in-symfony-3-4-simpler-injection-of-tagged-services). This library provides compiler pass in `\Zlikavac32\SymfonyExtras\DependencyInjection\Compiler\DynamicCompositePass` that provides a bit more functionality.

Read more about this concept in [docs/dynamic-composite.md](docs/dynamic-composite.md).

One might say that here is to much `magic` involved, but if you understand how it all works, there is hardly any magic left.

### buildMapOfTagsAndServiceIds()

[](#buildmapoftagsandserviceids)

Method `findTaggedServiceIds()` on the `\Symfony\Component\DependencyInjection\ContainerBuilder` finds tags in linear time depending on the number of services, so for `M` queries and `N` services, we have `N * M` operations.

Function `buildMapOfTagsAndServiceIds()` provided in this repo builds a map of tag names to the sets of service ids that are tagged with them. If we assume access to the hash map is in constant time, now we have `N + M` operations.

Do note that by not calling `findTaggedServiceIds()`, method `\Symfony\Component\DependencyInjection\ContainerBuilder::findUnusedTags()` will return more tags than it should. If you relay on that method, then this library is not for you.

Examples
--------

[](#examples)

Check [examples](examples) folder for examples.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Total

2

Last Release

2575d ago

### Community

Maintainers

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

---

Top Contributors

[![zlikavac32](https://avatars.githubusercontent.com/u/1078270?v=4)](https://github.com/zlikavac32 "zlikavac32 (34 commits)")

---

Tags

consoledependency-injectionphpsymfonyconsolesymfonydiccompiler pass

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zlikavac32-symfony-extras/health.svg)

```
[![Health](https://phpackages.com/badges/zlikavac32-symfony-extras/health.svg)](https://phpackages.com/packages/zlikavac32-symfony-extras)
```

###  Alternatives

[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/laravel-console-task

Laravel Console Task is a output method for your Laravel/Laravel Zero commands.

2582.1M11](/packages/nunomaduro-laravel-console-task)[contributte/console

Best Symfony Console for Nette Framework

983.6M49](/packages/contributte-console)[nunomaduro/laravel-console-summary

A Beautiful Laravel Console Summary for your Laravel/Laravel Zero commands.

662.0M3](/packages/nunomaduro-laravel-console-summary)[coresphere/console-bundle

This bundle allows you accessing the symfony2 console via your browser

146337.3k5](/packages/coresphere-console-bundle)[rahul900day/laravel-console-spinner

Laravel Console Spinner is a spinner output for Laravel command line.

76125.4k1](/packages/rahul900day-laravel-console-spinner)

PHPackages © 2026

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