PHPackages                             nextdots/api-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. [API Development](/categories/api)
4. /
5. nextdots/api-exceptions

ActiveLibrary[API Development](/categories/api)

nextdots/api-exceptions
=======================

JSON exceptions for your API

03851PHP

Since Jan 18Pushed 9y ago2 watchersCompare

[ Source](https://github.com/nextdots/api-exceptions)[ Packagist](https://packagist.org/packages/nextdots/api-exceptions)[ RSS](/packages/nextdots-api-exceptions/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

API Exceptions
==============

[](#api-exceptions)

Convert your **Lumen** exceptions into JSON:

```
{
  "code": nnn,
  "message": "a message",
  "description": "a description",
  "errors": [
    "error 1",
    "error 2",
    ...
  ]
}

```

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

[](#installation)

Set your `composer.json` to allow less stable packages:

```
"minimum-stability" : "dev",
"prefer-stable" : true

```

Require the package as usual:

```
composer require nextdots/api-exceptions
```

Change `app/Exceptions/Handler.php`:

- Change this:

    ```
    use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
    ```
- To this:

    ```
    use ApiExceptions\Handler as ExceptionHandler;
    ```

On Linux, you can do the same as above with the following command:

```
sed -i 's/Laravel\\Lumen\\Exceptions\\Handler/ApiExceptions\\Handler/' app/Exceptions/Handler.php
```

Example
-------

[](#example)

```
use ApiExceptions\JsonResponseException;

$app->get('/throw-exception', function () {
    throw new JsonResponseException(400, "an exception", "a description");
});
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7103003?v=4)[Juan Abadie](/maintainers/whoan)[@whoan](https://github.com/whoan)

---

Top Contributors

[![whoan](https://avatars.githubusercontent.com/u/7103003?v=4)](https://github.com/whoan "whoan (8 commits)")[![franciscocorrea](https://avatars.githubusercontent.com/u/8754065?v=4)](https://github.com/franciscocorrea "franciscocorrea (5 commits)")

### Embed Badge

![Health badge](/badges/nextdots-api-exceptions/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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