PHPackages                             avertys/json-api-response - 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. avertys/json-api-response

ActiveLibrary[API Development](/categories/api)

avertys/json-api-response
=========================

Send an elegant Json response from your api.

v1.0.1(3y ago)08[1 issues](https://github.com/steveaverty/laravel-json-api-response/issues)MITPHPPHP ^8.0

Since Aug 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/steveaverty/laravel-json-api-response)[ Packagist](https://packagist.org/packages/avertys/json-api-response)[ Docs](https://github.com/avertys/json-api-response)[ RSS](/packages/avertys-json-api-response/feed)WikiDiscussions master Synced 1w ago

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

This package allows you to send elegant json response from your Laravel api.
============================================================================

[](#this-package-allows-you-to-send-elegant-json-response-from-your-laravel-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/71822f43dab3e488e12f8d620103053623aa68be5606e4a30d645ea598f1f8b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617665727479732f6a736f6e2d6170692d726573706f6e73652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/averts/json-api-response)[![Total Downloads](https://camo.githubusercontent.com/99a648333854903e600b472d0a95c4b561a5bfcf9a86f1eca58307a526255bee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617665727479732f6a736f6e2d6170692d726573706f6e73652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/avertys/json-api-response)[![GitHub Actions](https://github.com/steveaverty/laravel-json-api-response/actions/workflows/php.yml/badge.svg)](https://github.com/steveaverty/laravel-json-api-response/actions/workflows/php.yml/badge.svg)

This package allows you to send elegant json response from your Laravel api.

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

[](#installation)

You can install the package via composer:

```
composer require avertys/json-api-response
```

Usage
-----

[](#usage)

### Successful response

[](#successful-response)

```
  return JsonApiResponse::make($data)
        ->withSuccess()
        ->send(200);
```

### Add additional data

[](#add-additional-data)

```
  return JsonApiResponse::make($data)
        ->withSuccess()
        ->withAdditionalData([
            'deprecated' => true
        ])
        ->send(200);
```

### Unsuccessful response

[](#unsuccessful-response)

```
  return JsonApiResponse::make()
        ->withErrors($validator->errors())
        ->withAdditionalData([
            'deprecated' => true
        ])
        ->send(200);
```

### Working with pagination

[](#working-with-pagination)

```
  return JsonApiResponse::make(User::paginate(10))
        ->withSuccess()
        ->send(200);
```

### Response format

[](#response-format)

```
{
    "success": true,
    "data": [
        "id": 1,
        "name": "John"
    ],
    "errors": null,
    "additional_data": [
        "pagination": {
            "current_page": 2,
            "to": 5,
            "total": 100
        },
        "deprecated": false
    ]
}
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Hoostr](https://github.com/hoostr)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Total

2

Last Release

1368d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0585175e98333f2a881690b935f6fd42813cfdf2e5820c092ae77d08c6f17e45?d=identicon)[steveaverty](/maintainers/steveaverty)

---

Top Contributors

[![steveaverty](https://avatars.githubusercontent.com/u/76013056?v=4)](https://github.com/steveaverty "steveaverty (9 commits)")

---

Tags

hoostrjson-api-response

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/avertys-json-api-response/health.svg)

```
[![Health](https://phpackages.com/badges/avertys-json-api-response/health.svg)](https://phpackages.com/packages/avertys-json-api-response)
```

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[spatie/laravel-route-discovery

Auto register routes using PHP attributes

23645.0k2](/packages/spatie-laravel-route-discovery)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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