PHPackages                             softdd/apiexception - 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. softdd/apiexception

ActiveLibrary[API Development](/categories/api)

softdd/apiexception
===================

api异常处理

v1.0(5y ago)013MITPHPPHP &gt;=7.0.0

Since Mar 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/phper5/laravelApiException)[ Packagist](https://packagist.org/packages/softdd/apiexception)[ RSS](/packages/softdd-apiexception/feed)WikiDiscussions main Synced 1w ago

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

softdd/apiexception
===================

[](#softddapiexception)

api 异常的简单封装，返回jso

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

[](#installation)

```
composer require softdd/apiexception
```

Usage
-----

[](#usage)

在所有需要抛出异常的地方

```
$error  = [
    'code'=>110,
     'msg'=>'msg',
     'httpCode'=>400,
     'headers'=>[]
];
throw (new \SoftDD\ApiException\ApiException($error));
// 更详细的定义可以用 ($error, $msg='',$detail=[],$previous=null)
```

可以把$error，以常量的方式放入到一个配置类中.

异常的输出json：

```
[
    'status'=>0,        //0 表示存在异常，正常返回1
    'data'=>[
        'code'=>'code',
        'msg'=>'message',
        'detail'=>[...] //错误的详细信息，存在时下发。
    ]
];
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

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

Unknown

Total

1

Last Release

1877d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29189650?v=4)[phper5](/maintainers/phper5)[@phper5](https://github.com/phper5)

---

Top Contributors

[![phper5](https://avatars.githubusercontent.com/u/29189650?v=4)](https://github.com/phper5 "phper5 (3 commits)")

---

Tags

apiexceptionsoftdd

### Embed Badge

![Health badge](/badges/softdd-apiexception/health.svg)

```
[![Health](https://phpackages.com/badges/softdd-apiexception/health.svg)](https://phpackages.com/packages/softdd-apiexception)
```

###  Alternatives

[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k34.0M112](/packages/darkaonline-l5-swagger)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[sajya/server

Easy implementation of the JSON-RPC 2.0 server for the Laravel framework.

2391.9M4](/packages/sajya-server)

PHPackages © 2026

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