PHPackages                             plakhin/laravel-request-chronicle - 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. plakhin/laravel-request-chronicle

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

plakhin/laravel-request-chronicle
=================================

Save incoming HTTP requests into the DB

1.1.1(1y ago)0475[2 PRs](https://github.com/plakhin/laravel-request-chronicle/pulls)MITPHPPHP ^8.4CI passing

Since Feb 6Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/plakhin/laravel-request-chronicle)[ Packagist](https://packagist.org/packages/plakhin/laravel-request-chronicle)[ Docs](https://github.com/plakhin/laravel-request-chronicle)[ GitHub Sponsors]()[ RSS](/packages/plakhin-laravel-request-chronicle/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (11)Versions (7)Used By (0)

Save incoming HTTP requests into the DB
=======================================

[](#save-incoming-http-requests-into-the-db)

[![Latest Version on Packagist](https://camo.githubusercontent.com/38b255ba6fbf37a3e68513e3fb148c92de029fbb1c81ea2efeec81ca9a9ce223/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706c616b68696e2f6c61726176656c2d726571756573742d6368726f6e69636c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/plakhin/laravel-request-chronicle)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2c6c7f3e78f05984e4025e2b8186e3ce46a8a6ae2263776fb2a74bcb240876a2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706c616b68696e2f6c61726176656c2d726571756573742d6368726f6e69636c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/plakhin/laravel-request-chronicle/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/0bc346671078747a14f10370beb4cf8b4f33b6ee07b395c8573a47246d1d3607/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706c616b68696e2f6c61726176656c2d726571756573742d6368726f6e69636c652f636865636b2d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/plakhin/laravel-request-chronicle/actions?query=workflow%3A%22Check+PHP+code+style+issues%22+branch%3Amain)[![GitHub PHPStan Action Status](https://camo.githubusercontent.com/4790d3142200b50604d09f05d4f5d651aa44b3a6b38ddbd9c32e2ad78a86046b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f706c616b68696e2f6c61726176656c2d726571756573742d6368726f6e69636c652f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d737461746963253230616e616c79736973267374796c653d666c61742d737175617265)](https://github.com/plakhin/laravel-request-chronicle/actions?query=workflow%3A%22PHPStan%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/ee8c062dfe728d43e3f0b8f7f8b47b07d38f85c9579d6023483be09bef48751d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706c616b68696e2f6c61726176656c2d726571756573742d6368726f6e69636c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/plakhin/laravel-request-chronicle)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require plakhin/laravel-request-chronicle
```

Then you may optionally publish the config file with:

```
php artisan vendor:publish --tag="request-chronicle-config"
```

This is the contents of the published config file:

```
return [
    'table_name' => 'request_chronicle',
    'prune_after_hours' => 24 * 7,
];
```

Then you need to publish and run the migrations with:

```
php artisan vendor:publish --tag="request-chronicle-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

If you want to save every HTTP request to the database, you may append it to the global middleware stack in your application's `bootstrap/app.php` file:

```
use Plakhin\RequestChronicle\Http\Middleware\SaveRequest;

->withMiddleware(function (Middleware $middleware) {
     $middleware->append(SaveRequest::class);
})
```

You can also apply the middleware to a specific route(s) only. Additionally you can specify the model you wish attach (using `MorphTo` relationship) requests to, [Route Model Binding](https://laravel.com/docs/routing#route-model-binding) should be used in this case:

```
use App\Models\YourModel;
use Plakhin\RequestChronicle\Http\Middleware\SaveRequest;

Route::get('{model:slug}/test', function (YourModel $model) {
    //
})->middleware(SaveRequest::class.':model');
```

All the requests will be stored in the database table specified in the config.

You can retrieve the requests using the `Request` model:

```
use Plakhin\RequestChronicle\Models\Request;

$requests = Request::all();
```

You can also add the `MorphMany` relationship to your model:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;

class YourModel extends Model
{
    public function requests(): MorphMany
    {
        return $this->morphMany(Request::class, 'model');
    }
}
```

### Pruning the database table

[](#pruning-the-database-table)

The `Request` model uses the [Laravel's `MassPrunable` trait](https://laravel.com/docs/eloquent#mass-pruning). In the config file, you can specify the number of hours to keep records using `prune_after_hours` key and then to schedule the `model:prune` command, as instructed in [Laravel's docs](https://laravel.com/docs/scheduling#scheduling-artisan-commands). You'll have to explicitly add the model class:

```
// in bootstrap/app.php

->withSchedule(function (Schedule $schedule) {
    $schedule->command('model:prune', [
        '--model' => [
            \Plakhin\RequestChronicle\Models\Request::class,
        ],
    ])->daily();
})
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Stanislav Plakhin](https://github.com/plakhin)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance67

Regular maintenance activity

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

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 ~17 days

Total

2

Last Release

540d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/38485ee20c25dd9ef5283bc202a33042d439b8fc33256fa71eca75b8180b6f18?d=identicon)[plakhin](/maintainers/plakhin)

---

Top Contributors

[![plakhin](https://avatars.githubusercontent.com/u/25561058?v=4)](https://github.com/plakhin "plakhin (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

laravelStanislav Plakhinlaravel-request-chronicle

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/plakhin-laravel-request-chronicle/health.svg)

```
[![Health](https://phpackages.com/badges/plakhin-laravel-request-chronicle/health.svg)](https://phpackages.com/packages/plakhin-laravel-request-chronicle)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

13.0k107.5M1.6k](/packages/spatie-laravel-permission)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.2k12.6M140](/packages/dedoc-scramble)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k5.4M50](/packages/spatie-laravel-pdf)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

46273.9k](/packages/harris21-laravel-fuse)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

25060.1k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

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