PHPackages                             midgard/toolbar-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. midgard/toolbar-bundle

AbandonedArchivedSymfony-bundle

midgard/toolbar-bundle
======================

Toolbar handling for Symfony2 applications

610[1 issues](https://github.com/bergie/MidgardToolbarBundle/issues)PHP

Since Jun 22Pushed 13y agoCompare

[ Source](https://github.com/bergie/MidgardToolbarBundle)[ Packagist](https://packagist.org/packages/midgard/toolbar-bundle)[ RSS](/packages/midgard-toolbar-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Symfony2 Toolbar Bundle
=======================

[](#symfony2-toolbar-bundle)

This bundle provides simple [toolbars](http://en.wikipedia.org/wiki/Toolbar) for Symfony2 applications. The toolbars consist of buttons that may have icons, labels and accesskeys associated with them. The buttons may trigger GET or POST actions on URLs.

The toolbars have been designed to be quite similar to [the toolbar concept in the MidCOM](http://www.midgard-project.org/development/mrfc/0026/) framework.

If you are looking for navigation menus instead of action-oriented toolbars, then [KnpMenuBundle](https://github.com/knplabs/KnpMenuBundle) is a better option.

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

[](#installation)

Install this bundle by adding the following to the `deps` file and running `php bin/vendors install`:

```
[MidgardToolbarBundle]
    git=git://github.com/bergie/MidgardToolbarBundle.git
    target=Midgard/ToolbarBundle

```

Then add the `Midgard` namespace to the `app/autoload.php`:

```
'Midgard' => __DIR__.'/../vendor'

```

And enable this bundle in your Kernel:

```
new Midgard\ToolbarBundle\MidgardToolbarBundle()

```

Usage
-----

[](#usage)

Toolbars can be used either directly, or through a toolbar provider. Direct toolbars are useful for situations where you want for example to add a toolbar to each item in a listing. Toolbars used via the toolbar provider can be used for shared toolbars on a web application where different parts of the application may register their own actions into the toolbar.

### Direct toolbars

[](#direct-toolbars)

```
use Midgard\ToolbarBundle\Toolbar\Toolbar;

$toolbar = new Toolbar();

// GET action
$toolbar->addItem(
    array(
        'url' => '/login',
        'label' => 'Log in',
        'icon' => '/web/some-icon.png',
        'helptext' => 'Log in to the system',
    )
);

// POST action
$toolbar->addItem(
    array(
        'url' => '/myformprocessor',
        'label' => 'Delete',
        'post' => true,
        'hiddenargs' => array(
            'article_id' => 1,
        ),
    )
);

echo $toolbar->render();

```

In addition to providing direct URLs to the `addItem` method, you can also have the Symfony2 router generate them for you. In that case provide the URL in array format, for example:

```
$toolbar->addItem(
    array(
        'url' => array(
            'route' => '_demo_hello',
            'parameters' => array(
                'name' => 'World',
            ),
        ),
        'label' => 'Say hello',
    )
);

```

For URL generation to work, you need to pass the Dependency Injection container to the toolbar with the `setContainer` method. Centralized toolbars explained below do this step automatically.

### Centralized toolbars

[](#centralized-toolbars)

Centralized toolbars are accessible from the provider by name. You can have multiple. For example, the [Midcom Compatibility Bundle](https://github.com/bergie/MidgardMidcomCompatBundle/) uses four:

- `view`: Toolbar associated with the main object of a page (actions like "edit")
- `node`: Toolbar associated with the bundle that provides the current view (actions like "add")
- `host`: Site-wide toolbar (actions like "logout")
- `help`: Access to contextual help

Quick usage example:

```
$toolbar = $this->container->get('midgard.toolbar.provider')->get('main');
$toolbar->addItem(...);

echo $this->container->get('midgard.toolbar.provider')->render('main');
// or echo $toolbar->render();

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0bbc65cfe3d54da56b43f1923784996c052d5cc2f39b0dbe19b0cefb487ef5e5?d=identicon)[bergie](/maintainers/bergie)

---

Top Contributors

[![bergie](https://avatars.githubusercontent.com/u/3346?v=4)](https://github.com/bergie "bergie (10 commits)")

### Embed Badge

![Health badge](/badges/midgard-toolbar-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/midgard-toolbar-bundle/health.svg)](https://phpackages.com/packages/midgard-toolbar-bundle)
```

PHPackages © 2026

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