Download the PHP package aihimel/laravel-waiting-request without Composer

On this page you can find all versions of the php package aihimel/laravel-waiting-request. 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 laravel-waiting-request

Laravel Waiting Request

Latest Version on Packagist Total Downloads PHP Version Laravel Version Tests Check Style PHPStan Security codecov

A simple implementation for holding requests until a job or background process is finished. This package allows you to conditionally block requests and wait for them to be unblocked within a specified timeout.

Installation

You can install the package via composer:

Configuration

You can publish the configuration file using:

The published configuration file config/waiting-request.php contains the following defaults:

Key Env Purpose
cache_prefix LW_REQUEST_CACHE_PREFIX Prepended to every cache key the package writes.
timeout LW_REQUEST_MAX_WAITING_TIME How long whenResolved() waits before giving up.
check_interval LW_REQUEST_CHECK_INTERVAL How often whenResolved() polls between checks.
max_blocking_time LW_REQUEST_MAX_BLOCKING_TIME Default lifetime of a blocker. After this many seconds, the next isBlocked() / whenResolved() call evicts the blocker and emits a warning log.

Usage

Basic Example

Suppose you have a resource that is being processed in the background (e.g., a large PDF generation or a data sync). You can block requests for this resource until the process is complete.

1. Add a Blocker

In your controller or job where the background process starts:

2. Wait for Resolution

In the request that needs to wait for the resource:

3. Resolve the Blocker

When the background process is finished:

Calling resolveBlocker() explicitly is still the recommended path — it releases the lock immediately so waiting requests can proceed and avoids the warning log emitted by the auto-expiry backstop (see below).

Checking if Blocked

You can also check if a resource is currently blocked without waiting:

Note: isBlocked() is not a pure read. If the blocker has passed its expiry, this call also forgets the cache entry and emits a Log::warning. Avoid placing it on a hot path that you expect to be side-effect-free.

Blocker Lifetime

Every blocker now has a finite lifetime.

The log line goes through Laravel's Log facade, so it honors whatever channel and formatter your app has configured in config/logging.php.

If you have a background job that may take longer than 10 seconds, raise LW_REQUEST_MAX_BLOCKING_TIME (or pass an explicit TTL to addBlocker()) — otherwise the blocker will be auto-released while your job is still running, defeating the purpose of the lock.

Upgrading

From 1.x to 2.x

Version 2.x changes how blockers expire. The public method signatures stay backwards-compatible, but the runtime behavior changes:

See CHANGELOG.md for the full change list.

Features & Bug Fixes

If you find any bugs or have a feature request, please create an issue on GitHub.

Contributing

We welcome contributions! To become a contributor:

  1. Fork the repository.
  2. Clone your fork to your local machine.
  3. Create a branch for your feature or bug fix.
  4. Commit your changes with descriptive messages.
  5. Push your branch to your fork.
  6. Submit a Pull Request to the main repository.

Local Development

This package comes with a Docker-based development environment.

Build container

Run automated tests

Run PHPCS code inspection

Run PHPCBF auto-fixer

License

The GPL-3.0-or-later License. Please see License File for more information.


All versions of laravel-waiting-request with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^10.0 || ^11.0 || ^12.0 || ^13.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 aihimel/laravel-waiting-request contains the following files

Loading the files please wait ...