PHPackages                             laratoolbox/responder - 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. laratoolbox/responder

ActiveLibrary[API Development](/categories/api)

laratoolbox/responder
=====================

Easily respond to api requests for laravel.

v0.1.0(5y ago)48MITPHPPHP &gt;=7.0

Since Jan 26Pushed 5y ago2 watchersCompare

[ Source](https://github.com/laratoolbox/responder)[ Packagist](https://packagist.org/packages/laratoolbox/responder)[ RSS](/packages/laratoolbox-responder/feed)WikiDiscussions main Synced 6d ago

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

Laravel Responder
=================

[](#laravel-responder)

Easily respond to api requests.

Requirement
===========

[](#requirement)

> Laravel &gt;= 5.5

Installation
============

[](#installation)

You can install the package via composer:

```
$ composer require laratoolbox/responder
```

Usage
=====

[](#usage)

After installation, you can use helper `responder` function.

```
return responder()
        ->addHeader('X-Secret1', 'secret1')
        ->addHeader('X-Secret2', 'secret2')
        ->addHeader('X-Secret3', 'secret3')
        ->setData(\App\Models\User::select('id', 'name')->find(1))
        ->addExtraData('custom-key', 'custom-value')
        ->send();
```

See response below:

```
HTTP/1.1 200 OK
Content-Type: application/json
X-Secret1: secret1
X-Secret2: secret2
X-Secret3: secret3

{
    "code": 0,
    "message": null,
    "data": {
        "id": 1,
        "name": "Semih ERDOGAN"
    },
    "custom-key": "custom-value"
}

```

Also, you have `ResponderException` that you can throw it any time required.

```
throw new \LaraToolbox\Responder\Exceptions\ResponderException(
    \LaraToolbox\Responder\ResponseCodes::ERROR,
    $customData = [1,2,3]
);
```

See response below:

```
HTTP/1.1 200 OK
Content-Type: application/json

{
    "code": 120,
    "message": "An error occurred",
    "data": [
        1,
        2,
        3
    ]
}

```

### All methods that responder has.

[](#all-methods-that-responder-has)

#### send

[](#send)

- Parameter `null|mixed $data` (if set calls setData method behind the scenes)

#### setHttpStatusCode

[](#sethttpstatuscode)

- Parameter `int $statusCode`

#### setResponseMeta

[](#setresponsemeta)

- Parameter `array $responseMeta`

#### setResponseCode

[](#setresponsecode)

- Parameter `int $responseCode`

#### setResponseMessage

[](#setresponsemessage)

- Parameter `string $responseMessage`

#### setData

[](#setdata)

- Parameter `mixed $data`

#### addExtraData

[](#addextradata)

- Parameter `string $key`
- Parameter `mixed $value`

#### addHeader

[](#addheader)

- Parameter `string $key`
- Parameter `string|integer|numeric $value`

Testing
=======

[](#testing)

// TODO:

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

- [Semih ERDOGAN](https://github.com/laratoolbox)
- [Dincer DEMIRCIOGLU](https://github.com/dinncer)
- [All contributors](https://github.com/laratoolbox/database-viewer/graphs/contributors)

License
=======

[](#license)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

1937d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5646041?v=4)[Semih ERDOGAN](/maintainers/semiherdogan)[@semiherdogan](https://github.com/semiherdogan)

---

Top Contributors

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

---

Tags

apiapi-responselaravelresponselaravelresponder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laratoolbox-responder/health.svg)

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

###  Alternatives

[flugger/laravel-responder

A Laravel Fractal package for building API responses, giving you the power of Fractal and the elegancy of Laravel.

8901.5M5](/packages/flugger-laravel-responder)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[mollie/laravel-mollie

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

3624.1M28](/packages/mollie-laravel-mollie)[api-ecosystem-for-laravel/dingo-api

A RESTful API package for the Laravel and Lumen frameworks.

3121.5M10](/packages/api-ecosystem-for-laravel-dingo-api)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[kirschbaum-development/laravel-openapi-validator

Automatic OpenAPI validation for Laravel HTTP tests

581.1M5](/packages/kirschbaum-development-laravel-openapi-validator)

PHPackages © 2026

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