Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Before After Bundle Laravel Package

expertcoder/before-after-bundle

A Symfony 2/3 bundle that runs code before every action in a controller. Implement ExecuteBeforeInterface on your controller and put logic in executeBefore() to execute automatically before any action method is invoked.

View on GitHub
Deep Wiki
Context7

Freelance Banner

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

Add to composer

composer require expertcoder/before-after-bundle

Add to AppKernal.php

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

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

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

  • executeAfter functionallity

Related Pages

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager