PHPackages                             coenond/lrvl-rspns - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. coenond/lrvl-rspns

ActiveLibrary[HTTP &amp; Networking](/categories/http)

coenond/lrvl-rspns
==================

A simple package for Laravel that helps you standardize your HTTP responses.

v0.1.3(7y ago)119MITPHP

Since Dec 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/coenond/lrvl-rspns)[ Packagist](https://packagist.org/packages/coenond/lrvl-rspns)[ RSS](/packages/coenond-lrvl-rspns/feed)WikiDiscussions master Synced yesterday

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

LRVL.RSPNS.
===========

[](#lrvlrspns)

[![Version](https://camo.githubusercontent.com/f693527d76977f1fc3daabd5b0fcb8eaa1e02b294d6a4ae72c961b2ad082befc/68747470733a2f2f706f7365722e707567782e6f72672f636f656e6f6e642f6c72766c2d7273706e732f762f737461626c65)](https://packagist.org/packages/coenond/lrvl-rspns) [![Total Downloads](https://camo.githubusercontent.com/b7bb15cca527b20089d33be0c50f9469a77fbe6915c59582ac52543300a5db24/68747470733a2f2f706f7365722e707567782e6f72672f636f656e6f6e642f6c72766c2d7273706e732f646f776e6c6f616473)](https://packagist.org/packages/coenond/lrvl-rspns)

A simple helper package for Laravel that helps you standardize your HTTP responses.

The helper includes multiple functions that returns a Json Response. Each function is already defined with the correct HTTP Status code.

Simply add this package to your Laravel project by running:

`composer require coenond/lrvl-rspns`

Example Usage
-------------

[](#example-usage)

The helper methodes can be used in controllers. For example in the User controller:

```
/**
 * get user by id.
 */
public function get($id)
{
    try {
        $user = User::findOrFail($id);
        return rspns_ok($user);
    } catch(ModelNotFoundException $e) {
        return rspns_not_found($id, $e->getMessage());
    }
}

/**
 * Do not create users like this in your system :)
 */
public function create(Request $request)
{
    $email = $request->input('email');
    $password = $request->input('password');

    if (User::whereEmail($email)->exists()) {
        return rspns_bad_request($request->all(), "User already exists");
    }

    $user = User::create(['email' => $email, 'password' => $password]);

    return rspns_created($user);
}
```

List of All helpers
-------------------

[](#list-of-all-helpers)

- `rspns_ok()`

    - Param `$data` is optional
    - Returns status code `200`
- `rspns_created()`

    - Param `$data` is optional
    - Returns status code `201`
- `rspns_accepted()`

    - Param `$data` is optional
    - Returns status code `202`
- `rspns_no_content()`

    - Param `$data` is optional
    - Returns status code `204`
- `rspns_bad_request()`

    - Param `$data` is optional
    - Param `$message` is optional
    - Returns status code `400`
- `rspns_unauthorized()`

    - Param `$data` is optional
    - Param `$message` is optional
    - Returns status code `401`
- `rspns_not_found()`

    - Param `$data` is optional
    - Param `$message` is optional
    - Returns status code `404`
- `rspns_method_not_allowed()`

    - Param `$data` is optional
    - Param `$message` is optional
    - Returns status code `405`
- `rspns_internal_server_error()`

    - Param `$data` is optional
    - Param `$message` is optional
    - Returns status code `500`
- `rspns_not_implemented()`

    - Param `$data` is optional
    - Param `$message` is optional
    - Returns status code `501`
- `rspns_bad_gateway()`

    - Param `$data` is optional
    - Param `$message` is optional
    - Returns status code `502`

### Success Responses

[](#success-responses)

The `2xx` (success) responses are defined with the status `success` and has an optional data object.

### Error Responses

[](#error-responses)

The `4xx` and `5xx` responses are defined with the status `success` and has an optional data object and message parameter.

NOTE: Unfortunately, PHP doesn't support named parameters, so if you want to return an error message *without data* is should be return like: `return rspns_bad_request(null, 'some messsage here');`

Contribution is always welcome :)
---------------------------------

[](#contribution-is-always-welcome-)

I developed this package as a 'scratch my own itch' solution. Feel free to open a Pull Request for message me for any suggestions.

🍺 Cheers!

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

5

Last Release

2710d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45da4516970c86b061164b06ef9763c32c1ff8f43e647b5ee01ca4c9b17fdf8f?d=identicon)[coenond](/maintainers/coenond)

---

Top Contributors

[![coenond](https://avatars.githubusercontent.com/u/18006579?v=4)](https://github.com/coenond "coenond (37 commits)")

### Embed Badge

![Health badge](/badges/coenond-lrvl-rspns/health.svg)

```
[![Health](https://phpackages.com/badges/coenond-lrvl-rspns/health.svg)](https://phpackages.com/packages/coenond-lrvl-rspns)
```

###  Alternatives

[php-http/client-integration-tests

HTTP Client integration tests

1773.1k26](/packages/php-http-client-integration-tests)

PHPackages © 2026

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