• Fabien Potencier's avatar
    merged branch fabpot/middleware (PR #362) · a1f29812
    Fabien Potencier authored
    Commits
    -------
    
    d53119eb added a route after middleware
    794b3c28 renamed middleware() to before()
    
    Discussion
    ----------
    
    Implements route after middleware (closes #336)
    
    This PR renames the `middleware` method to `before` and adds a new `after` route middleware.
    
    These changes make Silex more consistent from a user point of view:
    
     * he can do something before the route callback on an application, a route collection, or just a route (by calling the `before` method on these objects);
    
     * he can do something after the route callback by calling the `after` method on an application, a route collection, or just a route.
    
    ---------------------------------------------------------------------------
    
    by fabpot at 2012-06-13T18:20:37Z
    
    I thought about using the `middleware` method for both before and after by passing the callback as an argument. But this has several drawback:
    
     * we loose the symmetry with the application before/after calls;
     * the developer must remember to manually call the callback (and symfony1 proves that many devs actually forgets about that);
     * this would act as a filter chain where the order of execution is not always clear when you have many filters.
    a1f29812
usage.rst 23.9 KB