PHPackages                             onramplab/laravel-exceptions - 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. onramplab/laravel-exceptions

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

onramplab/laravel-exceptions
============================

Handling Laravel exceptions for logs and API response

v1.3.0(2y ago)019.8k—4%1MITPHPPHP &gt;=8.1

Since Jan 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/OnrampLab/laravel-exceptions)[ Packagist](https://packagist.org/packages/onramplab/laravel-exceptions)[ RSS](/packages/onramplab-laravel-exceptions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (11)Versions (6)Used By (1)

laravel-exceptions
==================

[](#laravel-exceptions)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![CircleCI](https://camo.githubusercontent.com/55a8869e79039250aa8fd97b028cebc8bafed75464a7c38d05832ab2ddf55d36/68747470733a2f2f636972636c6563692e636f6d2f67682f4f6e72616d704c61622f6c61726176656c2d657863657074696f6e732e7376673f7374796c653d736869656c64)](https://circleci.com/gh/OnrampLab/laravel-exceptions)[![Total Downloads](https://camo.githubusercontent.com/a46f7cf9b9b91571599bdb59ce503ec6c99056f8ddee1f645e58a62b9dea8a10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e72616d706c61622f6c61726176656c2d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/onramplab/laravel-exceptions)

If you are trying to create a new PHP Composer package, whether it is going to be submitted to packagist.org or just to exist in your Github account, this template package of files will surely help you make the process a lot easier and faster.

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

[](#requirements)

- PHP &gt;= 8.1;
- composer.

Features
--------

[](#features)

- Follow JSON API Spec
- Add more context to log for errors
    - adapter
        - Web
        - Console
        - Job

### API Error Response Example

[](#api-error-response-example)

```
{
  "errors": [
    {
      "title": "Resource Not Found",
      "detail": "User Not Found",
      "message": "User Not Found",
      "status": 400
    }
  ]
}
```

### Error Log Example

[](#error-log-example)

```
Here is the example of error log context:

```json
{
  "detail": "A fake message",
  "adapter": {
    "type": "API",
    "route": "test-route",
    "method": "GET",
    "url": "http://localhost/test-route",
    "input": []
  },
  "errors": [
    {
      "title": "Unable To Do Something",
      "detail": "A fake message",
      "exception_class": "OnrampLab\\CleanArchitecture\\Exceptions\\UseCaseException",
      "stacktrace": [
        "## /var/www/html/tests/Unit/Exceptions/HandlerTest.php(149)",
        "#0 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(1548): OnrampLab\\CleanArchitecture\\Tests\\Unit\\Exceptions\\HandlerTest->handleUseCaseException2()"
      ]
    },
    {
      "title": "Fake Domain Exception",
      "detail": "A fake message",
      "exception_class": "OnrampLab\\CleanArchitecture\\Tests\\Unit\\Exceptions\\FakeDomainException",
      "stacktrace": [
        "## /var/www/html/tests/Unit/Exceptions/HandlerTest.php(146)",
        "#0 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestCase.php(1548): OnrampLab\\CleanArchitecture\\Tests\\Unit\\Exceptions\\HandlerTest->handleUseCaseException2()"
      ]
    }
  ]
}
```

```

## Tech Features

- PSR-4 autoloading compliant structure;
- PSR-2 compliant code style;
- Unit-Testing with PHPUnit 6;
- Comprehensive guide and tutorial;
- Easy to use with any framework or even a plain php file;
- Useful tools for better code included.

## Installation

```bash
composer require onramplab/laravel-exceptions

```

Useful Tools
------------

[](#useful-tools)

Running Tests:
--------------

[](#running-tests)

```
php vendor/bin/phpunit

```

or

```
composer test

```

Code Sniffer Tool:
------------------

[](#code-sniffer-tool)

```
php vendor/bin/phpcs --standard=PSR2 src/

```

or

```
composer psr2check

```

Code Auto-fixer:
----------------

[](#code-auto-fixer)

```
composer psr2autofix
composer insights:fix
rector:fix

```

Building Docs:
--------------

[](#building-docs)

```
php vendor/bin/phpdoc -d "src" -t "docs"

```

or

```
composer docs

```

Changelog
---------

[](#changelog)

To keep track, please refer to [CHANGELOG.md](https://github.com/Onramplab/laravel-exceptions/blob/master/CHANGELOG.md).

Contributing
------------

[](#contributing)

1. Fork it.
2. Create your feature branch (git checkout -b my-new-feature).
3. Make your changes.
4. Run the tests, adding new ones for your own code if necessary (phpunit).
5. Commit your changes (git commit -am 'Added some feature').
6. Push to the branch (git push origin my-new-feature).
7. Create new pull request.

Also please refer to [CONTRIBUTION.md](https://github.com/Onramplab/laravel-exceptions/blob/master/CONTRIBUTION.md).

License
-------

[](#license)

Please refer to [LICENSE](https://github.com/Onramplab/laravel-exceptions/blob/master/LICENSE).

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

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

Total

5

Last Release

893d ago

### Community

Maintainers

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

---

Top Contributors

[![koshuang](https://avatars.githubusercontent.com/u/1978357?v=4)](https://github.com/koshuang "koshuang (17 commits)")

---

Tags

logapilaravelexceptionsexception handlingJSON API Spec

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/onramplab-laravel-exceptions/health.svg)

```
[![Health](https://phpackages.com/badges/onramplab-laravel-exceptions/health.svg)](https://phpackages.com/packages/onramplab-laravel-exceptions)
```

###  Alternatives

[ytake/laravel-fluent-logger

fluent logger for laravel and lumen

63541.6k1](/packages/ytake-laravel-fluent-logger)[moesif/moesif-laravel

Moesif Collection/Data Ingestion Middleware for Laravel

1065.8k](/packages/moesif-moesif-laravel)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[hosmelq/laravel-logsnag

Integrate the power of LogSnag's real-time event tracking into your Laravel application.

237.9k](/packages/hosmelq-laravel-logsnag)

PHPackages © 2026

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