PHPackages                             expertcoder/before-after-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. expertcoder/before-after-bundle

AbandonedArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

expertcoder/before-after-bundle
===============================

Symfony 2/3 Bundle to allow a before and after method which executes for each action

26.6k1PHP

Since Apr 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/expertcoder/before-after-bundle)[ Packagist](https://packagist.org/packages/expertcoder/before-after-bundle)[ RSS](/packages/expertcoder-before-after-bundle/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Freelance Banner](https://camo.githubusercontent.com/f9969859b325b35ebdf329034294c985a7ae0cf0f13329551cf8eb970375e9b8/68747470733a2f2f73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f7374617469632e657870657274636f6465722e696f2f6769746875622d62616e6e65722f62616e6e65722e706e67)](https://camo.githubusercontent.com/f9969859b325b35ebdf329034294c985a7ae0cf0f13329551cf8eb970375e9b8/68747470733a2f2f73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f7374617469632e657870657274636f6465722e696f2f6769746875622d62616e6e65722f62616e6e65722e706e67)

BeforeAfterBundle
=================

[](#beforeafterbundle)

Symfony 2/3 Bundle. If you want some code to execute before or after every action in particular controller, this bundle provides a very simple way to do this.

### Installation

[](#installation)

Add to composer

```
composer require expertcoder/before-after-bundle

```

Add to AppKernal.php

```
  public function registerBundles()
    {
        $bundles = [
            ....
            new ExpertCoder\BeforeAfterBundle\ExpertCoderBeforeAfterBundle(),
        ];

```

### Usage

[](#usage)

In any controller, where you would like to have some code run before each action, simply have that controller implement `ExpertCoder\BeforeAfterBundle\Other\ExecuteBeforeInterface`. Any code inside `executeBefore()` will run before the code inside the action method which is been invoked.

### Example

[](#example)

```
use ExpertCoder\BeforeAfterBundle\Other\ExecuteBeforeInterface;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;

class DefaultController extends Controller implements ExecuteBeforeInterface
{
    public function executeBefore(FilterControllerEvent $event)
    {
        /* code here will execute before the code inside homeAction() */
    }

    /**
     * @Template()
     * @Route("/home")
     */
    public function homeAction(Request $request)
    {
        // ....

        return array();
    }

```

### TODO

[](#todo)

- executeAfter functionallity

### Related Pages

[](#related-pages)

- [http://symfony.com/doc/current/cookbook/event\_dispatcher/before\_after\_filters.html](http://symfony.com/doc/current/cookbook/event_dispatcher/before_after_filters.html)
- [symfony/symfony#1975](https://github.com/symfony/symfony/issues/1975)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community8

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://avatars.githubusercontent.com/u/18326086?v=4)[Sam Anthony](/maintainers/expertcoder)[@expertcoder](https://github.com/expertcoder)

---

Top Contributors

[![expertcoder](https://avatars.githubusercontent.com/u/18326086?v=4)](https://github.com/expertcoder "expertcoder (7 commits)")

### Embed Badge

![Health badge](/badges/expertcoder-before-after-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/expertcoder-before-after-bundle/health.svg)](https://phpackages.com/packages/expertcoder-before-after-bundle)
```

PHPackages © 2026

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