Download the PHP package sobhanatar/idempotent without Composer

On this page you can find all versions of the php package sobhanatar/idempotent. 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 idempotent

Introduction

Idempotent package provides idempotency for your laravel package. However, in its current state, maybe not extendable to different requirements and can be used as a sample of doing so. Moreover, this package will be updated, in attempt to giving more control over various aspects of it.

Installation

To get started, install the Idempotent package via the Composer package manager:

Idempotent service provider registers its own config, language, and database migration file, so you need to export them

Note: If you don't want to use mysql database as shared memory, you can publish config, and language file using following command:

Deploying Idempotent

To use idempotent package, you need set the options as per the need of your service in configuration and language files. The configuration file is self-documented so that you can find your way through.

The next step is deciding on how you want to control the idempotency of your service. Idempotent package provides two middlewares that can help you achieve the idempotency; IdempotentHeader, and VerifyIdempotent. Don't forget to register the middleware in Kernel.php.

IdempotentHeader

IdempotentHeader makes an idempotent key/hash based on the entity's configurations and put it in the header of request. The assumption in this middleware is that the developer will remain responsible for the logic of using the idempotent header.

VerifyIdempotent

VerifyIdempotent handles all the required steps for making an endpoint idempotent. The steps are as follows:

  1. Get the entity configuration
  2. Create an idempotent key/hash based on the entity's configurations.
  3. Check if the idempotent key/hash exists in the selected storage.
  4. If it doesn't exist:
    1. A new record with the status of progress be created with the entity's timeout, and it continues to the logic of the service
    2. When code execution has finished, the response to the client updates the status and response of the cache.
  5. If it exists:
    1. If the status is done or fail, then the response will be read from storage and replied to the user.
    2. If the status is progress, the message in idempotent language file for that entity will be return as response to the user.

Note: Make sure to use any of two middlewares to only those routes that you want to be idempotent, and not all the routes.

Purging Idempotent Keys/Hashes

If you use mysql as the storage, it's important to purge the expired keys/hashes. Idempotent included idempotent:purge Artisan command can do this for you.

You may also configure a scheduled job in your application's App\Console\Kernel class to automatically prune your tokens on a schedule:

Under the hood

This package is relied on php-lock/lock for locking mechanism and also spatie/async for testing the locking mechanism.

Testing

Contributing

Thank you for considering contributing to Idempotent! You can read the contribution guide here.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

Idempotent is open-sourced software licensed under the MIT license.


All versions of idempotent with dependencies

PHP Build Version
Package Version
Requires php Version ~7.4|~8
ext-json Version *
ext-pdo Version *
malkusch/lock Version ^2.2
spatie/async Version ^1.5
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 sobhanatar/idempotent contains the following files

Loading the files please wait ....