PHPackages                             symfonyid/symfony-bundle-plugins - 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. symfonyid/symfony-bundle-plugins

ActiveLibrary[Framework](/categories/framework)

symfonyid/symfony-bundle-plugins
================================

Allow Symfony bundles to have plugins

2.0.3(10y ago)15.3k2MITPHPPHP &gt;=5.3

Since Jul 30Pushed 10y ago5 watchersCompare

[ Source](https://github.com/SymfonyId/BundlePlugins)[ Packagist](https://packagist.org/packages/symfonyid/symfony-bundle-plugins)[ Docs](http://github.com/ihsanudin/symfony-bundle-plugins)[ RSS](/packages/symfonyid-symfony-bundle-plugins/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (6)Used By (2)

Symfony Bundle Plugins
======================

[](#symfony-bundle-plugins)

By Originally Matthias Noback

This package helps you create extensible bundles, by introducing a plugin system for bundles. Each bundle plugin can define its own services and configuration. This basically makes your bundles conform to the open/closed principle.

Setup
-----

[](#setup)

Install this library in your project by running

```
composer require ihsanudin/symfony-bundle-plugins

```

Example
-------

[](#example)

First, your bundle should extend `PluginBundle`. You need to implement the `getAlias` method. It should return the name of your bundle's configuration key (as it will be used in `config.yml` for instance).

```
use Symfonian\Indonesia\BundlePlugins\PluginBundle;

class DemoBundle extends PluginBundle
{
    protected function getAlias()
    {
        return 'demo';
    }
}
```

Each plugin for the bundle should implement `PluginBundle`:

```
use Symfonian\Indonesia\BundlePlugins\PluginBundle;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class FooPlugin implements PluginBundle
{
    public function name()
    {
        return 'foo';
    }

    public function load(
        array $pluginConfiguration,
        ContainerBuilder $container
    ) {
        // load specific service definitions for this plugin,
        // just like you would do in a bundle extension

        $loader = new YamlFileLoader($container, new FileLocator(__DIR__));
        $loader->load('foo.yml');

        // $pluginConfiguration contains just the values that are relevant
        // for this plugin
    }

    public function addConfiguration(ArrayNodeDefinition $pluginNode)
    {
        // add plugin-specific configuration nodes,
        // just like you would do in a bundle extension

        $pluginNode
            ->children()
                ->scalarNode('foo')
                ->isRequired()
            ->end();
    }
}
```

When instantiating this bundle in your `AppKernel` class, you can provide any number of `PluginBundle` instances:

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        return array(
            ...,
            new DemoBundle(array(new FooPlugin()))
        );
    }
}
```

If some of the plugins are required, just introduce a `CorePlugin` and make sure it is always registered by overriding your bundle's `alwaysRegisteredPlugins()` method:

```
class DemoBundle
{
    ...

    protected function alwaysRegisteredPlugins()
    {
        return array(new CorePlugin());
    }
}
```

Register compiler passes
------------------------

[](#register-compiler-passes)

When a bundle plugin needs to register a compiler pass, it can do so in its `build()` method.

```
class FooPlugin implements PluginBundle
{
    ...

    public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(...);
    }
}
```

Booting a plugin
----------------

[](#booting-a-plugin)

Whenever the main bundle is booted, plugins are allowed to do some runtime initialization as well. They can do this in their `boot()` method. At that time, the fully initialized service container is available:

```
class FooPlugin implements PluginBundle
{
    ...

    public function boot(ContainerInterface $container)
    {
        // runtime initialization (will run when the kernel itself is
        // booted)
    }
}
```

Simple plugins
--------------

[](#simple-plugins)

If your plugin is quite simple (i.e. only needs a `load()` method), just make the plugin class extend `SimplePluginBundle` which contains stub implementations for the interface methods that you won't need.

Thanks
------

[](#thanks)

To [@dennisdegreef](https://github.com/dennisdegreef) for reviving the test suite of this project.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

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

Total

5

Last Release

3888d ago

Major Versions

1.0 → 2.0.02015-07-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7464920?v=4)[Muhamad Surya Iksanudin](/maintainers/ad3n)[@ad3n](https://github.com/ad3n)

---

Top Contributors

[![ad3n](https://avatars.githubusercontent.com/u/7464920?v=4)](https://github.com/ad3n "ad3n (24 commits)")

---

Tags

pluginsymfonybundle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/symfonyid-symfony-bundle-plugins/health.svg)

```
[![Health](https://phpackages.com/badges/symfonyid-symfony-bundle-plugins/health.svg)](https://phpackages.com/packages/symfonyid-symfony-bundle-plugins)
```

###  Alternatives

[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[league/tactician-bundle

Bundle to integrate Tactician with Symfony projects

24810.1M18](/packages/league-tactician-bundle)[sensiolabs/gotenberg-bundle

A Symfony bundle that provides seamless integration with Gotenberg for generating PDFs and screenshots from various sources (HTML, Markdown, Office documents, URLs) with a clean, builder-based API.

210210.4k2](/packages/sensiolabs-gotenberg-bundle)[orbitale/cms-bundle

A simple lightweight CMS bundle for Symfony

6343.2k](/packages/orbitale-cms-bundle)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[cmsig/seal-symfony-bundle

An integration of CMS-IG SEAL search abstraction into Symfony Framework.

15195.8k5](/packages/cmsig-seal-symfony-bundle)

PHPackages © 2026

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