PHPackages                             clarkwinkelmann/flarum-ext-idempotency - 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. clarkwinkelmann/flarum-ext-idempotency

ActiveFlarum-extension

clarkwinkelmann/flarum-ext-idempotency
======================================

Add idempotency keys to Flarum API

0.1.0(5y ago)05MITPHP

Since Apr 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/clarkwinkelmann/flarum-ext-idempotency)[ Packagist](https://packagist.org/packages/clarkwinkelmann/flarum-ext-idempotency)[ RSS](/packages/clarkwinkelmann-flarum-ext-idempotency/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (1)Versions (2)Used By (0)

Idempotency
===========

[](#idempotency)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667) [![Latest Stable Version](https://camo.githubusercontent.com/e02f98787aec54256c183f919863f6f81f3980a7a474cc0fea7bbe1d211128e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636c61726b77696e6b656c6d616e6e2f666c6172756d2d6578742d6964656d706f74656e63792e737667)](https://packagist.org/packages/clarkwinkelmann/flarum-ext-idempotency) [![Total Downloads](https://camo.githubusercontent.com/7ea17080e7fab25d081a1705d5b06527690c66d00d07dd3d6844a339decf5ef5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c61726b77696e6b656c6d616e6e2f666c6172756d2d6578742d6964656d706f74656e63792e737667)](https://packagist.org/packages/clarkwinkelmann/flarum-ext-idempotency) [![Donate](https://camo.githubusercontent.com/0d6e4d8b50b5983a58205941b1a581b1305903393b7a39da574e3f60af3c7f5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d79656c6c6f772e737667)](https://www.paypal.me/clarkwinkelmann)

This extension is meant primarily as a proof of concept, but is fully working. Let me know which use cases you find for it!

It implements optionally idempotent POST requests to Flarum REST API.

It then modifies the Flarum frontend so discussion and post creation uses them.

Idempotency is requested by passing a `Idempotency-Key` header with a unique value. If another request is made with the same key, it will be ignored and the previous response will be returned again.

Key aspects:

- Can be used on all POST routes of the REST API, including those registered by extensions.
- Only works with requests returning an instanceof Laminas' `JsonResponse`. Attempting to use the idempotency key on a different response type will return in a 400 error, but the request will still be performed!
- The key has to be unique per actor. Guests cannot use idempotency keys.
- If the body of the request does not match the original request with the same idempotency key, a 400 error will be thrown.
- Only successful requests are cached. It's assumed that any thrown exception was before any data was saved.
- Cache is configured to 24h and is currently not configurable.

Concerns:

- The extension cannot differentiate between exceptions happening before or after data saving. The choice was made to not cache those requests so they can be attempted again. You should use an async queue to reduce the risk of this happening.
- The default filesystem cache driver of Flarum will quickly fill with entries and I don't think it auto-cleans expired files. You should probably use a different cache driver on any important forum.
- Extensions that add headers or modify JSON responses based on some internal state through middlewares might be impacted. It might be necessary to change the boot order of extensions depending on the situation.
- Race conditions could allow two requests made at the same time to be both executed. Using an async queue driver will help with this issue as the sooner the first request finishes, the sooner a cached response will be available for the second request.

Installation
------------

[](#installation)

Make sure you understand the description above. Most likely you don't need/want that extension.

```
composer require clarkwinkelmann/flarum-ext-idempotency

```

Support
-------

[](#support)

This extension is under **minimal maintenance**.

It was developed for a client and released as open-source for the benefit of the community. I might publish simple bugfixes or compatibility updates for free.

You can [contact me](https://clarkwinkelmann.com/flarum) to sponsor additional features or updates.

Support is offered on a "best effort" basis through the Flarum community thread.

Links
-----

[](#links)

- [GitHub](https://github.com/clarkwinkelmann/flarum-ext-idempotency)
- [Packagist](https://packagist.org/packages/clarkwinkelmann/flarum-ext-idempotency)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1856d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0538135c1debcef5602dce7ece027909cc832b7a6284ab9189a19aa8de98d60d?d=identicon)[clarkwinkelmann](/maintainers/clarkwinkelmann)

---

Top Contributors

[![clarkwinkelmann](https://avatars.githubusercontent.com/u/5264300?v=4)](https://github.com/clarkwinkelmann "clarkwinkelmann (1 commits)")

---

Tags

flarumidempotence

### Embed Badge

![Health badge](/badges/clarkwinkelmann-flarum-ext-idempotency/health.svg)

```
[![Health](https://phpackages.com/badges/clarkwinkelmann-flarum-ext-idempotency/health.svg)](https://phpackages.com/packages/clarkwinkelmann-flarum-ext-idempotency)
```

###  Alternatives

[fof/upload

The file upload extension for the Flarum forum with insane intelligence.

188171.7k15](/packages/fof-upload)[fof/byobu

Well integrated, advanced private discussions.

61105.8k9](/packages/fof-byobu)[fof/gamification

Upvotes and downvotes for your Flarum community

4157.1k6](/packages/fof-gamification)[fof/user-bio

Add a user bio to user profiles

2196.5k9](/packages/fof-user-bio)[flarum-lang/russian

Russian language pack for Flarum.

13126.1k](/packages/flarum-lang-russian)[fof/drafts

Allow users to create post and discussion drafts

1771.1k5](/packages/fof-drafts)

PHPackages © 2026

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