PHP code example of alkinbg / http-idempotency-bundle

1. Go to this page and download the library: Download alkinbg/http-idempotency-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alkinbg / http-idempotency-bundle example snippets




return [
    // ...
    Alkin\HttpIdempotencyBundle\AlkinHttpIdempotencyBundle::class => ['all' => true],
];



namespace App\Controller;

use Alkin\HttpIdempotencyBundle\Attribute\Idempotent;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;

final class OrderController
{
    #[Route('/orders', name: 'orders_create', methods: ['POST'])]
    #[Idempotent]
    public function create(): JsonResponse
    {
        // Perform the application operation.

        return new JsonResponse(['created' => true], 201);
    }
}