Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Idempotency Bundle Laravel Package

conejerock/idempotency-bundle

View on GitHub
Deep Wiki
Context7

Custom extractor

A typical case may be that the requesting party does not make the request with an idempotent key. Or the key is sent in two or more different fields.

Or, perhaps, you only want to cached responses to a certain resource.

If you need a more specific way to extract the key, you can create a custom exctractor, inheriting from the AbstractExtractor class, and adding in the configuration the extractor option as follows:

# config/packages/idempotency.yaml
idempotency:
    name: api
    extractor: 'App\Extractor\MyCustomExtractor::class'

And the class MyCustomExtractor::class as follow:

<?php
declare(strict_types=1);

namespace App\Extractor;

use Conejerock\IdempotencyBundle\Extractor\AbstractExtractor;
use Symfony\Component\HttpFoundation\Request;

class MyCustomExtractor extends AbstractExtractor
{
    public function extract(Request $request): ?string
    {
       return $request->getMethod()."-".$request->query->get('resourceId');
    }
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
cadot.eu/make
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky