PHPackages                             imransaleem/http-db-logger - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. imransaleem/http-db-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

imransaleem/http-db-logger
==========================

Middleware to log HTTP requests and responses to database

v1.0.1(7mo ago)023MITPHPPHP ^7.4|^8.0

Since Jul 30Pushed 7mo agoCompare

[ Source](https://github.com/imransaleem25/http-db-logger)[ Packagist](https://packagist.org/packages/imransaleem/http-db-logger)[ RSS](/packages/imransaleem-http-db-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Http DB Logger
==============

[](#http-db-logger)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f131ab74a756916dd9469f25a25a37a70f682551c37efdeaa74adbfea2e33dfd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696d72616e73616c65656d2f687474702d64622d6c6f676765722e737667)](https://packagist.org/packages/imransaleem/http-db-logger)[![License](https://camo.githubusercontent.com/931919ce66f294286332ae41e66ee93bab212c66e974f09aeccb76cff33612de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696d72616e73616c65656d2f687474702d64622d6c6f676765722e737667)](LICENSE)

A Laravel middleware package to log all incoming HTTP requests into the database.

---

📦 Installation
--------------

[](#-installation)

You can install the package via Composer:

```
composer require imransaleem/http-db-logger
```

🔧 Configuration (Optional)
--------------------------

[](#-configuration-optional)

If you're not using Laravel package auto-discovery, add the service provider manually in `config/app.php`:

```
'providers' => [
    // Other service providers...
    Imransaleem\HttpDbLogger\HttpDbLoggerServiceProvider::class,
],
```

🛡 Register Middleware
---------------------

[](#-register-middleware)

Add the middleware in `app/Http/Kernel.php`:

```
protected $middleware = [
    // Other middleware...
    \Imransaleem\HttpDbLogger\Middleware\LogHttpToDatabase::class,
];
```

🚀 Publish Configuration &amp; Migration
---------------------------------------

[](#-publish-configuration--migration)

To publish the config and migration files, run:

```
php artisan vendor:publish --tag=config
php artisan vendor:publish --tag=migrations
```

Then run the migration:

```
php artisan migrate
```

✅ Example Usage
---------------

[](#-example-usage)

You can apply the middleware to a specific route group like this:

```
use \Imransaleem\HttpDbLogger\Middleware\LogHttpToDatabase;

Route::middleware(['auth', LogHttpToDatabase::class])->group(function () {
    Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
});
```

⚙️ Configuration Options
------------------------

[](#️-configuration-options)

You can customize the logger via `config/http-db-logger.php`. Options include:

- `log_requests`: boolean default true,
- `log_authenticated_user`: Log user ID and role if authenticated.
- `table`: logging table for database

🗃 Database Table
----------------

[](#-database-table)

The package creates a `http_db_logs` table with the following fields:

- `id`
- `method`
- `uri`
- `ip`
- `headers`
- `body`
- `created_by` (nullable)
- `user_role` (nullable)
- `created_at` / `updated_at`

---

© 2025 [Imran Saleem](https://github.com/imransaleem) — Licensed under MIT

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance63

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~55 days

Total

2

Last Release

228d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b7acd23f447b810f8f80219c40b86b45b67e71fd08934967bc282f79cb4fe023?d=identicon)[imransaleem](/maintainers/imransaleem)

---

Top Contributors

[![imransaleem25](https://avatars.githubusercontent.com/u/221933665?v=4)](https://github.com/imransaleem25 "imransaleem25 (1 commits)")

### Embed Badge

![Health badge](/badges/imransaleem-http-db-logger/health.svg)

```
[![Health](https://phpackages.com/badges/imransaleem-http-db-logger/health.svg)](https://phpackages.com/packages/imransaleem-http-db-logger)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)

PHPackages © 2026

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