Download the PHP package tourze/json-rpc-lock-bundle without Composer

On this page you can find all versions of the php package tourze/json-rpc-lock-bundle. 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 json-rpc-lock-bundle

JsonRPC Lock Bundle

中文

Build Status PHP Version Require License Latest Version Total Downloads Code Coverage

A Symfony Bundle that provides automatic locking functionality for JsonRPC interfaces to handle concurrent request control and idempotency.

Features

Dependencies

This bundle requires:

Installation

Install via Composer:

Configuration

Register the bundle in your Symfony application:

No additional configuration is required. The bundle works out of the box with sensible defaults.

Quick Start

Create a JsonRPC procedure by extending LockableProcedure:

Advanced Usage

Custom Lock Resources

Override the getLockResource method to customize locking behavior:

Idempotency Support

Enable request caching for idempotent operations:

Cached results expire after 60 seconds by default. If a cached result exists, it will be returned immediately without acquiring locks or executing the procedure.

Fallback Retry

Enable automatic retry without locking for non-critical operations:

How It Works

  1. Lock Resource Preparation: Based on user identity or procedure name

    • Authenticated users: Uses user.getUserIdentifier()
    • Anonymous requests: Uses procedure class name
    • Custom: Override getLockResource() method
  2. Idempotency Check: Returns cached result if available and cache key is set

  3. Lock Acquisition: Acquires distributed lock using LockService.blockingRun()

  4. Execution: Runs the actual procedure logic via parent::__invoke()

  5. Result Caching: Stores result for 60 seconds (if idempotent cache key is provided)

  6. Exception Handling:
    • Lock conflicts: Returns cached result or throws "你手速太快了,请稍候" message
    • General exceptions: Logs error and optionally retries without lock if fallbackRetry() returns true

Environment Variables

Testing

Run the test suite:

For static analysis:

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes and add tests
  4. Ensure tests pass (./vendor/bin/phpunit)
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

License

This bundle is released under the MIT License. See the LICENSE file for details.


All versions of json-rpc-lock-bundle with dependencies

PHP Build Version
Package Version
Requires psr/log Version ^3|^2|^1
symfony/cache-contracts Version ^3
symfony/config Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/framework-bundle Version ^7.4
symfony/http-kernel Version ^7.3
symfony/lock Version ^7.3
symfony/property-access Version ^7.3
symfony/security-bundle Version ^7.3
symfony/security-core Version ^7.3
symfony/service-contracts Version ^3.6
symfony/yaml Version ^7.3
tourze/backtrace-helper Version 1.*
tourze/bundle-dependency Version 1.*
tourze/json-rpc-core Version 2.0.*
tourze/lock-service-bundle Version 1.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 tourze/json-rpc-lock-bundle contains the following files

Loading the files please wait ...