PHPackages                             cego/request-insurance - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. cego/request-insurance

ActiveProject[HTTP &amp; Networking](/categories/http)

cego/request-insurance
======================

Package for Laravel that facilitates and ensures that http requests are sent

4.0.0(2w ago)157.7k↓29%[7 PRs](https://github.com/cego/request-insurance/pulls)4MITPHPPHP ^8.3CI passing

Since Sep 10Pushed 1w agoCompare

[ Source](https://github.com/cego/request-insurance)[ Packagist](https://packagist.org/packages/cego/request-insurance)[ RSS](/packages/cego-request-insurance/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (80)Versions (250)Used By (4)

request-insurance
=================

[](#request-insurance)

[![QA](https://github.com/cego/request-insurance/actions/workflows/quality-assurance.yml/badge.svg)](https://github.com/cego/request-insurance/actions/workflows/quality-assurance.yml)

Guaranteed delivery of outbound HTTP requests for Laravel.

Instead of firing an HTTP request and hoping it arrives, you *insure* it: the request is persisted to the database first, then delivered asynchronously by a worker that retries with exponential backoff, keeps a log of every attempt, and hands permanently failing requests to a human through a built-in management UI where they can be inspected, edited (with peer approval), retried, or abandoned.

Use it for requests that must not be lost when the receiving service is down, times out, or your own process dies mid-request — webhooks, downstream service calls, third-party API writes.

Supported versions
------------------

[](#supported-versions)

Package versionPHP versions supportedStatus^1^7.4, ^8.0Security and bug fixes only^2^8.3Security and bug fixes only^3^8.3Security and bug fixes only^4^8.3Active developmentInstallation
------------

[](#installation)

```
composer require cego/request-insurance
```

The service provider is auto-discovered and the migrations load automatically — run them with `php artisan migrate`. To tweak configuration, publish the config file:

```
php artisan vendor:publish --provider="Cego\RequestInsurance\RequestInsuranceServiceProvider"
```

Creating requests
-----------------

[](#creating-requests)

Build and persist a request with the fluent builder — this only writes a database row, delivery happens asynchronously:

```
use Cego\RequestInsurance\Models\RequestInsurance;

RequestInsurance::getBuilder()
    ->url('https://api.example.com/webhooks')
    ->method('post')
    ->payload(['event' => 'order.shipped', 'order_id' => 123])
    ->headers(['Authorization' => 'Bearer ' . $token])
    ->traceId($traceId)      // optional: correlation id, searchable in the UI
    ->priority(5)            // optional: zero-based, 0 is processed first
    ->timeoutMs(5000)        // optional: per-request timeout
    ->create();
```

Processing
----------

[](#processing)

A long-lived worker polls for requests that are due and delivers them:

```
php artisan process:request-insurances
```

Run one or many — workers coordinate through row locking (`SELECT … FOR UPDATE SKIP LOCKED` on MySQL 8+) and claim requests in priority order, `batchSize` at a time.

### Cycle budget

[](#cycle-budget)

Each batch is sent concurrently in chunks of `concurrentHttpChunkSize`, which defaults to the whole batch. A cycle has `maximumSecondsPerWorkerCycle` (120s) to finish, after which the worker considers itself stuck and exits — leaving the chunk it was sending to be recovered by `request-insurance:unstuck-processing` some minutes later. The worst case is:

```
ceil(batchSize / concurrentHttpChunkSize) * timeoutInSeconds

```

The defaults therefore need a single `timeoutInSeconds` (20s) at worst, well inside the budget, while lowering the chunk size means checking that arithmetic against it. A chunk size of `1` sends requests strictly one at a time in priority order, which only fits a small batch or a short timeout.

Concurrency also means requests within a batch complete in whatever order the receivers respond, so `priority` orders which requests get claimed, not which arrive first. The same goes for running more than one worker: a single worker with a chunk size of `1` is the only setup that delivers in strict order.

The deprecated `concurrentHttpEnabled` setting is still honoured when set to `false`, which does the same thing as a chunk size of `1`.

### Lifecycle

[](#lifecycle)

 ```
flowchart LR
    WAITING --> READY --> PENDING --> PROCESSING
    PROCESSING -->|2xx| COMPLETED
    PROCESSING -->|4xx| FAILED
    PROCESSING -->|5xx / timeout| WAITING
    FAILED -->|retry / edit| READY
    FAILED -->|abandon| ABANDONED
```

      Loading StateMeaning`WAITING`Waiting for its `retry_at` timestamp before becoming ready`READY`Ready for a worker to pick up (default state)`PENDING`Reserved by a worker, about to be processed`PROCESSING`Actively being sent`COMPLETED`Delivered with a successful response`FAILED`Received a response or timeout that requires human intervention`ABANDONED`Given up on — will never be processed againServer errors and timeouts are retried with exponential backoff (`retry_factor ^ attempts`seconds, factor 2 by default, capped at `retry_cap`, 1 hour by default) up to `maximumNumberOfRetries`. Client errors (4xx) fail immediately — resending the same request would just fail again, so a human decides: edit it, retry it, or abandon it. Inconsistent outcomes (e.g. the process died mid-request) fail by default but can be retried automatically via `retryInconsistentDefault` or per request with `->retryInconsistentState()`.

### Maintenance

[](#maintenance)

The package schedules its own housekeeping (offset per application so fleets do not thunder):

CommandCadencePurpose`unlock:request-insurances`every 5 minReleases requests stuck in `PENDING``request-insurance:unstuck-processing`every 10 minFails or readies requests stuck in `PROCESSING``clean:request-insurances`every 10 minDeletes `COMPLETED` rows older than `cleanUpKeepDays`Encryption and masking
----------------------

[](#encryption-and-masking)

Sensitive parts of a request can be encrypted at rest and are shown masked in the UI:

```
RequestInsurance::getBuilder()
    ->headers(['X-Api-Key' => $secret])
    ->encryptHeader('X-Api-Key')
    ->payload(['card' => $number])
    ->encryptPayloadField('card')
    ->create();
```

`Authorization` headers are always encrypted by default — see `fieldsToAutoEncrypt` in the config.

Events
------

[](#events)

Hook into processing with standard Laravel event listeners:

EventFired`RequestBeforeProcess`Before a request is sent`RequestSuccessful`On a 2xx response`RequestClientError`On a 4xx response`RequestServerError`On a 5xx response`RequestFailed`When a request transitions to `FAILED``RequestInconsistent`When a request ends in an inconsistent stateAll live under `Cego\RequestInsurance\Events`.

Management UI
-------------

[](#management-ui)

The package ships a web UI at `/vendor/request-insurances` (route name `request-insurances.index`) with automatic light/dark mode:

- Pipeline overview with live per-state counts and cursor pagination
- Filtering by trace id, url, date range, and state
- Bulk retry / abandon of selected requests
- Per-request inspection: payload, headers, timings, response, and the full attempt log
- Editing of failed requests (method, url, payload, headers, priority) gated behind four-eyes approval, with a diff view and an audit trail of applied edits

Protect the `/vendor` path with your application's own auth middleware — the package does not impose any.

Monitoring
----------

[](#monitoring)

JSON endpoints suitable for dashboards and alerting: `/vendor/request-insurances/load` (worker load), `/monitor` (active/failed totals), and `/monitor_segmented` (per-state counts). If [spatie/laravel-prometheus](https://github.com/spatie/laravel-prometheus) is installed, matching Prometheus gauges are registered automatically.

Development
-----------

[](#development)

```
vendor/bin/phpunit
vendor/bin/php-cs-fixer fix
```

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance97

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity90

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Recently: every ~2 days

Total

164

Last Release

20d ago

Major Versions

0.22.1 → 1.0.02023-07-25

1.4.2 → 2.0.02024-09-09

2.1.3 → 3.0.02025-03-03

1.5.0 → 3.2.22025-05-15

3.7.3 → 4.0.02026-07-31

PHP version history (4 changes)0.0.21PHP ^7.3

0.1.3PHP ^7.3|^8.0

0.4.0PHP ^7.4|^8.0

2.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d79d2046d4c647d13783eaedebc0044f9e824fd211e2b23281aaf727222e3f2?d=identicon)[cego](/maintainers/cego)

---

Top Contributors

[![nizacegodk](https://avatars.githubusercontent.com/u/71869936?v=4)](https://github.com/nizacegodk "nizacegodk (290 commits)")[![GustavBruhns](https://avatars.githubusercontent.com/u/56824719?v=4)](https://github.com/GustavBruhns "GustavBruhns (228 commits)")[![LauJosefsen](https://avatars.githubusercontent.com/u/44977457?v=4)](https://github.com/LauJosefsen "LauJosefsen (104 commits)")[![jabjcegodk](https://avatars.githubusercontent.com/u/89517617?v=4)](https://github.com/jabjcegodk "jabjcegodk (83 commits)")[![wogelius](https://avatars.githubusercontent.com/u/16867541?v=4)](https://github.com/wogelius "wogelius (38 commits)")[![firecow](https://avatars.githubusercontent.com/u/973602?v=4)](https://github.com/firecow "firecow (11 commits)")[![moberghammer](https://avatars.githubusercontent.com/u/909915?v=4)](https://github.com/moberghammer "moberghammer (11 commits)")[![nbj](https://avatars.githubusercontent.com/u/8373450?v=4)](https://github.com/nbj "nbj (10 commits)")[![mawocego](https://avatars.githubusercontent.com/u/91113376?v=4)](https://github.com/mawocego "mawocego (8 commits)")[![kpmcego](https://avatars.githubusercontent.com/u/90258354?v=4)](https://github.com/kpmcego "kpmcego (5 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (3 commits)")[![jakobkollerup](https://avatars.githubusercontent.com/u/128644226?v=4)](https://github.com/jakobkollerup "jakobkollerup (3 commits)")[![mmacego](https://avatars.githubusercontent.com/u/86605507?v=4)](https://github.com/mmacego "mmacego (2 commits)")[![smbcego](https://avatars.githubusercontent.com/u/154420375?v=4)](https://github.com/smbcego "smbcego (2 commits)")[![OleKal](https://avatars.githubusercontent.com/u/55442686?v=4)](https://github.com/OleKal "OleKal (2 commits)")[![RasmusBorup](https://avatars.githubusercontent.com/u/12410209?v=4)](https://github.com/RasmusBorup "RasmusBorup (2 commits)")[![mjncegodk](https://avatars.githubusercontent.com/u/239349517?v=4)](https://github.com/mjncegodk "mjncegodk (2 commits)")[![kris914g](https://avatars.githubusercontent.com/u/5894703?v=4)](https://github.com/kris914g "kris914g (1 commits)")[![jensbaagaard](https://avatars.githubusercontent.com/u/154625866?v=4)](https://github.com/jensbaagaard "jensbaagaard (1 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (1 commits)")

### Embed Badge

![Health badge](/badges/cego-request-insurance/health.svg)

```
[![Health](https://phpackages.com/badges/cego-request-insurance/health.svg)](https://phpackages.com/packages/cego-request-insurance)
```

###  Alternatives

[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k31.8M162](/packages/laravel-cashier)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9922.4M146](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k16.3M154](/packages/laravel-pulse)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
