Download the PHP package freerkminnema/synchronized without Composer

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

This package installs a global synchronized function into your Laravel application that ensures that the given callable is always executed one at a time, even if multiple requests are coming in.

So if your application receives ten requests in parallel, and part of your code is wrapped in the synchronized function, that block will be executed sequentially.

Requires a supported cache driver

This function uses the Cache Atomic Locks feature of Laravel. To utilize this feature, your application must be using the memcached, redis, dynamodb, database, or file cache driver as your application's default cache driver. In addition, if relevant, all web servers must be communicating with the same central cache server.

Example usage

In its most elegant form, you can pass a simple closure to the synchronized function:

How does it work?

Internally, synchronized generates an Atomic Lock Key (which is simply a hashed string) based on the location of and variables in the callable. This is just like how the ✨magic✨ once function works.

Providing your own Atomic Lock Key

In some cases, you may want to provide your own Atomic Lock Key. A contrived example is provided below:

Everytime $nameOnTicket has a different value, a different Atomic Lock Key will be autogenerated, and it will probably not work as you intended.

To resolve this, you may tweak your closure to be less dependent on outside variables OR provide your own $key as the second variable.

Providing an Eloquent model as Atomic Lock Key

Alternatively, you may provide an instance of a saved Eloquent model to use as the Atomic Lock Key. This approach means the callback will be executed one at a time for every unique record in your database.


All versions of synchronized with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/cache Version ^10.0|^11.0|^12.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 freerkminnema/synchronized contains the following files

Loading the files please wait ....