Download the PHP package netglue/expressive-prg without Composer
On this page you can find all versions of the php package netglue/expressive-prg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download netglue/expressive-prg
More information about netglue/expressive-prg
Files in netglue/expressive-prg
Package expressive-prg
Short Description Middleware to implement the Post/Redirect/Get pattern in Zend Expressive
License MIT
Homepage https://github.com/netglue/Expressive-PRG
Informations about the package expressive-prg
Post/Redirect/Get Middleware for Zend Expressive
Intro
This is simple middleware that'll help you implement the PRG pattern in your Zend Expressive app.
Based on the original Zend Framework PRG controller plugin.
Uses Zend\Session
but performs no configuration of the session itself. I figured this was a sane choice for session management. If you know of a standard session library to typehint against, let me know, but afaik there isn't one…
Installation
Usage
First you'll need to register the middleware with your DI container as an invokable with something like:
Add the middleware to your routes whenever you want to perform a PRG something like this:
Inside your action, the request will have an attribute prg
set to either false or the posted data (If any), for example:
The request attribute name is defined as a constant in PostRedirectGet::KEY
It is possible for the attribute to be null if the request is neither a GET, nor a POST request and your route allows other methods such as PUT, DELETE etc…
Tests
About
Netglue makes web based stuff in Devon, England. We hope this is useful to you and we’d appreciate feedback either way :)