PHPackages                             mrgarest/echo-api - 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. mrgarest/echo-api

ActiveLibrary[API Development](/categories/api)

mrgarest/echo-api
=================

A simple package for generating API responses in Laravel

1.0.4(1mo ago)0273MITPHPPHP &gt;=8.1

Since Sep 19Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/mrgarest/echo-api)[ Packagist](https://packagist.org/packages/mrgarest/echo-api)[ Docs](https://github.com/mrgarest/echo-api)[ RSS](/packages/mrgarest-echo-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

EchoApi
=======

[](#echoapi)

⚠️ THIS LIBRARY IS NO LONGER SUPPORTED AND WILL SOON BE REMOVED!!!

A simple package for generating API responses in Laravel.

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

[](#installation)

You can install the package via composer:

```
composer require mrgarest/echo-api

```

Examples
========

[](#examples)

Below are some examples using the methods for different responses.

Success
-------

[](#success)

To create a successful JSON response, you can use the method:

```
return EchoApi::success();
```

Response result:

```
{
  "success": true
}
```

### Adding additional data

[](#adding-additional-data)

If you want to add additional data to the response, you can pass an array with data to the `success()` method.

```
$data = [
    'user' => [
        'id' => 21314,
        'role' => 'user',
        'email' => 'email@example.com'
    ]
];

return EchoApi::success($data);
```

Response result:

```
{
  "success": true,
  "user": {
    "id": 21314,
    "role": "user",
    "email": "email@example.com"
  }
}
```

Error
-----

[](#error)

To create a JSON response with the HTTP error code, you can use the method:

```
$httpStatus = Response::HTTP_NOT_FOUND; // 404 Not Found
return EchoApi::httpError($httpStatus);
```

Response result:

```
{
  "success": false,
  "error": {
    "code": 404,
    "message": "Bad Request"
  }
}
```

### Custom error

[](#custom-error)

If the standard HTTP error codes are not enough for you, you can use your own by creating them in the `config/echo-api.php` file.

```
return EchoApi::findError('EXAMPLE');
```

Response result:

```
{
  "success": false,
  "error": {
    "code": "EXAMPLE",
    "message": "Example of error data structure"
  }
}
```

*To get `echo-api.php`, don't forget to run `php artisan vendor:publish`.*

### Adding additional data

[](#adding-additional-data-1)

As with the `success()` method, you can add additional data to the responses for the `httpError()` and `findError()` methods.

```
$data = [
    'error' = [
        'uuid' => '21e38f4d-3be8-457c-98da-3059a947e75b'
    ],
    'count' => 0,
    'data' => null
];
return EchoApi::httpError(Response::HTTP_NOT_FOUND, $data);
```

Response result:

```
{
  "success": false,
  "error": {
    "code": 404,
    "message": "Bad Request",
    "uuid": "21e38f4d-3be8-457c-98da-3059a947e75b"
  },
  "count": 0,
  "data": null
}
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance89

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

5

Last Release

54d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4828c20df7aa59ea7f47e7cb820ee7effe24be077f03d5167c99e32202bb17ee?d=identicon)[garest](/maintainers/garest)

---

Top Contributors

[![mrgarest](https://avatars.githubusercontent.com/u/181940227?v=4)](https://github.com/mrgarest "mrgarest (12 commits)")

---

Tags

apijsonlaravellaravel-packagephpresponsephpjsonapilaravelGarest

### Embed Badge

![Health badge](/badges/mrgarest-echo-api/health.svg)

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

###  Alternatives

[obiefy/api-response

Simple Laravel package to return Json responses.

17324.6k](/packages/obiefy-api-response)[wayofdev/laravel-symfony-serializer

📦 Laravel wrapper around Symfony Serializer.

2113.6k](/packages/wayofdev-laravel-symfony-serializer)[nilportugues/laravel5-json-api-dingo

Laravel5 JSONAPI and Dingo together to build APIs fast

311.5k](/packages/nilportugues-laravel5-json-api-dingo)

PHPackages © 2026

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