PHPackages                             pensoft/awt-error-formatter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pensoft/awt-error-formatter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pensoft/awt-error-formatter
===========================

A PHP class for formatting error payloads.

v1.0.5(9mo ago)0352[1 issues](https://github.com/pensoft/awt-error-formatter/issues)1MITPHPPHP ^8.0

Since Feb 5Pushed 9mo ago4 watchersCompare

[ Source](https://github.com/pensoft/awt-error-formatter)[ Packagist](https://packagist.org/packages/pensoft/awt-error-formatter)[ RSS](/packages/pensoft-awt-error-formatter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (1)

ErrorPayloadFormatter
=====================

[](#errorpayloadformatter)

[![Build Status](https://camo.githubusercontent.com/e629b7dc3a0b32380d63c91a90dd41e84db516a8b9f943a76210b6c190b10c26/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70656e736f66742f6177742d6572726f722d666f726d61747465722f6d61737465722e737667)](https://travis-ci.org/pensoft/awt-error-formatter)[![Latest Version](https://camo.githubusercontent.com/f53f40e68e559f3543a4e99a392da779d6f8dddfc8df94834e27e32467cccac7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70656e736f66742f6177742d6572726f722d666f726d61747465722e737667)](https://packagist.org/packages/pensoft/awt-error-formatter)[![License](https://camo.githubusercontent.com/dd940da4b81e7f7fd2589ded74e05e31f8c9f14fd681b084be85b839b4619f41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70656e736f66742f6177742d6572726f722d666f726d61747465722e737667)](LICENSE)

A PHP class for formatting error payloads in applications. This package provides a simple and consistent way to convert error information into a structured array format, making it easier to log, display, or broadcast errors throughout your application.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)

Features
--------

[](#features)

- **Consistent Error Formatting:** Provides a custom format for error payloads.
- **Laravel Integration:** Utilizes `Illuminate\Http\Request` for request data and accepts any `Throwable` instance for flexible error handling.
- **PSR-4 Autoloading:** Easily integrates into your projects via Composer.
- **Robust Error Handling:** Supports the latest PHP error handling best practices by using the `Throwable` interface.

Requirements
------------

[](#requirements)

- PHP 8.0 or later
- Laravel (if integrating into a Laravel project)

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

[](#installation)

You can install the package via Composer. Add the following line to your project's `composer.json` file:

```
composer require pensoft/awt-error-formatter
```

Usage
-----

[](#usage)

Include in your PHP class/file

```
use Pensoft\AwtErrorFormatter\ErrorPayloadFormatter;
```

Formatting the error

```
// Format the error payload
$errorPayload = ErrorPayloadFormatter::format(
    Request $request,
    Throwable $e,
    'serviceName',
    'serviceId'
);
//send $errorPayload to third-party library or service
```

Response format

```
[
    'service_name'  => $serviceName,
    'service_id'    => $serviceId ?? 'no-service-id',  // or cast to string/number as needed
    'message'       => $throwable->getMessage(),       // string error message
    'user_id'       => $userId,                        // e.g., UUID or null
    'timestamp'     => now()->timestamp,               // integer Unix timestamp
    'service_type'  => $serviceType,                   // e.g., 'backend' or 'frontend'

    // "details" section with request info & error code
    'details' => [
        'error_type'    => $errorType,                      // e.g., 'HTTP' or 'CRONJOB'
        'uri'           => $request->fullUrl(),             // e.g. "https://example.com/path"
        'method'        => $request->method(),              // e.g. "GET", "POST", etc.
        'user_agent'    => $request->header('User-Agent') ?? 'unknown',
        'payload'       => $request->all(),                 // entire request input as an array
        'error_code'    => $throwable->getCode(),           // numeric or 0 if none
        'stack_trace'   => $throwable->getTrace(),          // array full stack trace
        'file_name'     => $throwable->getFile(),           // file path
        'line_number'   => $throwable->getLine(),           // integer line number
    ],
]
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance55

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity47

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

Recently: every ~42 days

Total

6

Last Release

298d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fb92632a52a188f3c34442b532e0f8d355604ef87577a0d2c37edbdd4e14bd5?d=identicon)[pensoft](/maintainers/pensoft)

---

Top Contributors

[![sdemirov](https://avatars.githubusercontent.com/u/1354621?v=4)](https://github.com/sdemirov "sdemirov (6 commits)")

### Embed Badge

![Health badge](/badges/pensoft-awt-error-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/pensoft-awt-error-formatter/health.svg)](https://phpackages.com/packages/pensoft-awt-error-formatter)
```

PHPackages © 2026

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