Download the PHP package bvtterfly/replay without Composer

On this page you can find all versions of the php package bvtterfly/replay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package replay

🚨 THIS PACKAGE HAS BEEN ABANDONED 🚨

I no longer use Laravel and cannot justify the time needed to maintain this package. That's why I have chosen to abandon it. Feel free to fork my code and maintain your own copy.

πŸ”„ Replay - Idempotency Middleware

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package makes your endpoints idempotent easily.

Check out this Stripe Blog Post about Idempotency.

Implementation inspired by Stripe API.

πŸ’‘ Features

Installation

You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

Note: Replay needs a cache driver that supports Cache Tags & Atomic Locks features. Refer to Laravel's documentation to see if your driver supports these features.

Optionally, you can publish the translations using

✨ Server Usage

The Bvtterfly\Replay\Replay-middleware must be registered in the kernel:

Next, For idempotent an endpoint, apply replay middleware to it:

By default, Replay stores the idempotent key as a cache key in the cache store, So all routes with replay middleware share the same cache key with an idempotent key. It's Okay to store it this way in most cases, but in some scenarios, we just need to separate them. In these scenarios, we can add a prefix to cache keys using middleware parameters:

Custom Policy

Replay use Policy to determine whether a request is idempotent and whether the response should be recorded. By default, Replay includes and uses StripePolicy Policy. To create your custom policy, you first need to implement the \Bvtterfly\Replay\Contracts\Policy contract:

If you want to view an example implementation take a look at the StripePolicy class.

For using this policy, We can change the policy in the config file.

✨ Client Usage

To perform an idempotent request, Client must provide an additional Idempotency-Key : <key> header with a unique key to the request.

it is recommended to:

Once Replay detects a key, it'll look it up in cache store. If found, it will serve the same response without hitting your controller action again.

To identify a previously executed response that’s being replayed from the server, look for the header Idempotent-Replayed: true.

If Replay can't find the key, it attempts to acquire a cache lock and caches successful or server error responses. Still, if it can't acquire the lock, another request with the same key is already in progress, then it will respond with the HTTP Conflict response status code.

Resetting the Cache

If you need to manually reset the cache for this package, you may use the following artisan command:

πŸ§ͺ Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of replay with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/laravel-package-tools Version ^1.9.2
illuminate/contracts Version ^9.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bvtterfly/replay contains the following files

Loading the files please wait ....