PHPackages                             sarahman/laravel-http-request-api-log - 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. [Framework](/categories/framework)
4. /
5. sarahman/laravel-http-request-api-log

ActiveLibrary[Framework](/categories/framework)

sarahman/laravel-http-request-api-log
=====================================

This library stores the http request api log into a database table.

1.0.3(2y ago)112.7k↓47.6%12MITPHPPHP &gt;=5.5

Since Sep 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sarahman/laravel-http-request-api-log)[ Packagist](https://packagist.org/packages/sarahman/laravel-http-request-api-log)[ RSS](/packages/sarahman-laravel-http-request-api-log/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (2)

API Log Activity inside Laravel Application
===========================================

[](#api-log-activity-inside-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ac833a257018d357c5a0b6c33d2524a31ec9362ea035f5bd48ee7921bb1eb3b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73617261686d616e2f6c61726176656c2d687474702d726571756573742d6170692d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sarahman/laravel-http-request-api-log)[![Build Status](https://camo.githubusercontent.com/fb507d0ff1f6243ea2c4615f77b47bf5f647bce7f5f5fcb79f5425d358ac6797/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73617261686d616e2f6c61726176656c2d687474702d726571756573742d6170692d6c6f672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/sarahman/laravel-http-request-api-log)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7885608bbd597281d3e8b0f6e84dc7556edfab0278627c114fb8641d048439d4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73617261686d616e2f6c61726176656c2d687474702d726571756573742d6170692d6c6f672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sarahman/laravel-http-request-api-log/?branch=master)[![StyleCI](https://camo.githubusercontent.com/b99f51a99d2353acca3cd535443c8897ccb52f6c705c86425578f5a9c5ff7dbc/68747470733a2f2f7374796c6563692e696f2f7265706f732f3638363133393930302f736869656c64)](https://styleci.io/repos/686139900)[![Total Downloads](https://camo.githubusercontent.com/398ebbe5395adf7a594803d9b15064d78a3bf332f54a4998217ee096c05cde74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73617261686d616e2f6c61726176656c2d687474702d726571756573742d6170692d6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sarahman/laravel-http-request-api-log)[![License](https://camo.githubusercontent.com/fbe47cb7fec3ec42b66c4a66668efa5ef2ca80c298ca59f287f21a86b2c41b8b/687474703a2f2f706f7365722e707567782e6f72672f73617261686d616e2f6c61726176656c2d687474702d726571756573742d6170692d6c6f672f6c6963656e7365)](https://packagist.org/packages/sarahman/laravel-http-request-api-log)[![PHP Version Require](https://camo.githubusercontent.com/557f620a716d5889ab792bb8402abb842f56506f75f2613f2e3affbc5752e450/687474703a2f2f706f7365722e707567782e6f72672f73617261686d616e2f6c61726176656c2d687474702d726571756573742d6170692d6c6f672f726571756972652f706870)](https://packagist.org/packages/sarahman/laravel-http-request-api-log)

The `sarahman/laravel-http-request-api-log` package provides easy to use functionality to log the http api logs in the `Laravel` application. All the api logs will be stored in the `_api_calls` table.

You can retrieve all api logs using the `Sarahman\HttpRequestApiLog\Models\ApiLog` model.

```
ApiLog::all();
```

Here's a more advanced example:

```
...
use GuzzleHttp\Psr7\Response;
use Illuminate\Database\Eloquent\Model;
use Sarahman\HttpRequestApiLog\Traits\WritesHttpLogs;

class ApiClient
{
    use WritesHttpLogs;
    ...
    ...
    public function __construct()
    {
        ...
        ...
        $this->enableLogging = false; // Overwrite the logging functionality being enabled or not.
    }
    ...
    ...
    public function sampleMethod()
    {
        ...
        ...
        $this->log('POST', $url, $options, new Response(200));
    }
}
```

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

[](#installation)

You can install the package via composer:

```
composer require sarahman/laravel-http-request-api-log
```

Next, you need to load the service provider:

```
// app/config/app.php
'providers' => [
    ...
    Sarahman\HttpRequestApiLog\HttpRequestApiLogServiceProvider::class,
];
```

You can publish the config file with:

```
php artisan config:publish sarahman/laravel-http-request-api-log
```

This is the contents of the published config file:

```
return [
    /*
     * If set to false, no api log will be saved to the database.
     */
    'enabled' => true,

    /*
     * This model will be used to log activity.
     * It should extend Illuminate\Database\Eloquent\Model.
     */
    'api_log_model' => \Sarahman\HttpRequestApiLog\Models\ApiLog::class,

    /*
     * This is the database connection that will be used by the migration and
     * the ApiLog model shipped with this package. In case it's not set
     * Laravel's database.default will be used instead.
     */
    'database_connection' => 'mysql',

    /*
     * This is the name of the table that will be created by the migration and
     * used by the ApiLog model shipped with this package.
     */
    'table_name' => '_api_calls',
];
```

You can also publish the migration with:

```
php artisan migrate:publish sarahman/laravel-http-request-api-log
```

Now, you can create the `_api_calls` table by running the migrations:

```
php artisan migrate
```

**N.B.:** You can disable the api logging to a specific api client using the `enableLogging` property setting as false.

Testing
-------

[](#testing)

You might go to the project directory and run the following command to run test code.

```
composer test
```

Contribution
------------

[](#contribution)

Feel free to contribute in this library. Please make your changes and send us [pull requests](https://github.com/sarahman/sms-service-with-bd-providers/pulls).

Security Issues
---------------

[](#security-issues)

If you discover any security related issues, please feel free to create an issue in the [issue tracker](https://github.com/sarahman/laravel-http-request-api-log/issues) or write us at .

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% 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 ~68 days

Total

4

Last Release

784d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c482155504a6d98bd167e89aaf9a873d1355cd771cbe2a0c11cab87a5296845?d=identicon)[sarahman](/maintainers/sarahman)

---

Top Contributors

[![shohoz-abid](https://avatars.githubusercontent.com/u/57485589?v=4)](https://github.com/shohoz-abid "shohoz-abid (21 commits)")[![sarahman](https://avatars.githubusercontent.com/u/3045127?v=4)](https://github.com/sarahman "sarahman (1 commits)")

---

Tags

httprequestlogapiframeworklaravellumen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sarahman-laravel-http-request-api-log/health.svg)

```
[![Health](https://phpackages.com/badges/sarahman-laravel-http-request-api-log/health.svg)](https://phpackages.com/packages/sarahman-laravel-http-request-api-log)
```

###  Alternatives

[laravel/lumen-framework

The Laravel Lumen Framework.

1.5k26.2M709](/packages/laravel-lumen-framework)[lanin/laravel-api-debugger

Easily debug your JSON API.

2311.8M](/packages/lanin-laravel-api-debugger)[laravel-lang/publisher

Localization publisher for your Laravel application

2167.7M24](/packages/laravel-lang-publisher)[saad/api-debugger

Easily debug your JSON API.

1170.1k](/packages/saad-api-debugger)[lanin/laravel-api-exceptions

All in one solution for exception for JSON REST APIs on Laravel and Lumen.

40102.4k](/packages/lanin-laravel-api-exceptions)

PHPackages © 2026

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