2017 © Pedro Peláez
 

library laravel-idempotency

Laravel Idempotency Middleware

image

javidalpe/laravel-idempotency

Laravel Idempotency Middleware

  • Saturday, February 24, 2018
  • by javidalpe
  • Repository
  • 1 Watchers
  • 3 Stars
  • 223 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 68 % Grown

The README.md

Laravel Idempotent Requests

First, what is Idempotency and why I need it?, (*1)

Checkout this awesome post from Brandum Leach., (*2)

Install

Require this package with composer using the following command:, (*3)

composer require javidalpe/laravel-idempotency 

Usage

Register Idempotency middleware on your http kernel file:, (*4)

'api' => [
    'throttle:60,1',
    'bindings',
    \Javidalpe\Idempotency\Idempotency::class,
], 

To perform an idempotent request, provide an additional Idempotency-Key: <key> header to the request., (*5)

How it works

If the header Idempotency-Key is present on the request and the request method is different from GET, PUT and DELETE, the middleware stores the response on the cache. Next time you make a request with same idempotency key, the middleware will return the cached response., (*6)

How you create unique keys is up to you, but I suggest using V4 UUIDs or another appropriately random string. It'll always send back the same response for requests made with the same key, and keys can't be reused with different request parameters. Keys expire after 24 hours., (*7)

License

The Laravel Idempotency is open-sourced software licensed under the MIT license, (*8)

The Versions

24/02 2018

dev-master

9999999-dev

Laravel Idempotency Middleware

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Javier Vidal

laravel api middleware idempotency

24/02 2018

v1.0

1.0.0.0

Laravel Idempotency Middleware

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Javier Vidal

laravel api middleware idempotency