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

ActiveLibrary[API Development](/categories/api)

yared/api-response
==================

Advanced API response formatter for Laravel

v1.0.0(3mo ago)00MITPHPPHP ^8.1

Since Mar 6Pushed 3mo agoCompare

[ Source](https://github.com/yared-ayele-debela/Laravel-api-response)[ Packagist](https://packagist.org/packages/yared/api-response)[ RSS](/packages/yared-api-response/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Yared API Response
==================

[](#yared-api-response)

Advanced API response formatter for Laravel. Provides consistent, professional JSON responses for your API.

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

[](#installation)

```
composer require yared/api-response
```

Or for local development, add to your Laravel project's `composer.json`:

```
{
    "repositories": [
        {
            "type": "path",
            "url": "../laravel-api-response"
        }
    ]
}
```

Then:

```
composer require yared/api-response
```

Publish Config
--------------

[](#publish-config)

```
php artisan vendor:publish --tag=api-response-config
```

Usage
-----

[](#usage)

### Success Response

[](#success-response)

```
use Yared\ApiResponse\Facades\ApiResponse;

return ApiResponse::success($user, "User fetched successfully");
```

### Error Response

[](#error-response)

```
return ApiResponse::error("User not found", 404);
```

### Pagination

[](#pagination)

```
return ApiResponse::paginate(User::paginate(10));
```

### Validation Errors

[](#validation-errors)

```
return ApiResponse::error("Validation failed", 422, $validator->errors());
```

Example Output
--------------

[](#example-output)

```
{
    "success": true,
    "message": "Users retrieved",
    "data": [...],
    "meta": {
        "request_id": "f24e4f21-...",
        "timestamp": "2026-03-05T22:50:00+00:00"
    }
}
```

Configuration
-------------

[](#configuration)

Edit `config/api-response.php` to customize:

- `success_key` - Key for success flag
- `message_key` - Key for message
- `data_key` - Key for data payload
- `meta_key` - Key for meta information
- `request_id` - Include unique request ID
- `include_timestamp` - Include response timestamp

Middleware
----------

[](#middleware)

Add `FormatApiResponse` middleware to API routes for automatic response formatting. Register in `app/Http/Kernel.php`:

```
protected $middlewareAliases = [
    // ...
    'api.format' => \Yared\ApiResponse\Middleware\FormatApiResponse::class,
];
```

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance79

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

109d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5727fb2630a34a7641505a6a706230943683ed204aa0fa244343ae5622f61872?d=identicon)[yared-ayele-debela](/maintainers/yared-ayele-debela)

---

Top Contributors

[![yared-ayele-debela](https://avatars.githubusercontent.com/u/112660399?v=4)](https://github.com/yared-ayele-debela "yared-ayele-debela (3 commits)")

---

Tags

apiformat-jsonjsonlaravellaravel-packagephp

### Embed Badge

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

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

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[riclep/laravel-storyblok

A Laravel wrapper around the Storyblok API to provide a familiar experience for Laravel devs

6277.0k5](/packages/riclep-laravel-storyblok)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)[rapidez/core

Rapidez Core

1822.4k65](/packages/rapidez-core)

PHPackages © 2026

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