PHPackages                             netglue/expressive-prg - 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. netglue/expressive-prg

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

netglue/expressive-prg
======================

Middleware to implement the Post/Redirect/Get pattern in Zend Expressive

1.0.1(9y ago)17241MITPHPCI failing

Since Sep 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/netglue/Expressive-PRG)[ Packagist](https://packagist.org/packages/netglue/expressive-prg)[ Docs](https://github.com/netglue/Expressive-PRG)[ RSS](/packages/netglue-expressive-prg/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Post/Redirect/Get Middleware for Zend Expressive
================================================

[](#postredirectget-middleware-for-zend-expressive)

Intro
-----

[](#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](https://zendframework.github.io/zend-mvc-plugin-prg/).

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
------------

[](#installation)

```
$ composer require netglue/expressive-prg
```

Usage
-----

[](#usage)

First you'll need to register the middleware with your DI container as an invokable with something like:

```
// use NetglueExpressive\Middleware\PostRedirectGet;

'dependencies' => [
    'invokables' => [
        PostRedirectGet::class => PostRedirectGet::class
    ],
],
```

Add the middleware to your routes whenever you want to perform a PRG something like this:

```
'routes' => [
    'some-form' => [
        'name' => 'some-form',
        'path' => '/somewhere',
        'allowed_methods' => ['GET', 'POST'],
        'middleware' => [
            PostRedirectGet::class
            // Your middleware to post process, render templates etc…
        ],
    ],
],
```

Inside your action, the request will have an attribute `prg` set to either false or the posted data *(If any)*, for example:

```
$post = $request->getAttribute('prg');
if (false === $post) {
    // No POST has occurred, probably render the form template
}

// Otherwise, process POST data, validate, store, whatever…
```

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
-----

[](#tests)

```
$ cd vendor/netglue/expressive-prg
$ composer install
$ phpunit
```

About
-----

[](#about)

[Netglue makes web based stuff in Devon, England](https://netglue.uk). We hope this is useful to you and we’d appreciate feedback either way :)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~174 days

Total

2

Last Release

3381d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a6c21b0de8cc9938916a186f5f2ed0bee90a4e23e0b29cf7b9c18bfe99067f9b?d=identicon)[netglue](/maintainers/netglue)

---

Top Contributors

[![gsteel](https://avatars.githubusercontent.com/u/2803720?v=4)](https://github.com/gsteel "gsteel (3 commits)")

---

Tags

zendexpressiveprgnetglue

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/netglue-expressive-prg/health.svg)

```
[![Health](https://phpackages.com/badges/netglue-expressive-prg/health.svg)](https://phpackages.com/packages/netglue-expressive-prg)
```

###  Alternatives

[zendtech/ibmitoolkit

PHP frontend to XMLSERVICE for IBM i development.

4786.6k6](/packages/zendtech-ibmitoolkit)

PHPackages © 2026

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