PHPackages                             petarpetkovic996/laravel-jsend-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. petarpetkovic996/laravel-jsend-response

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

petarpetkovic996/laravel-jsend-response
=======================================

JSend Response Macro's for Laravel

1.0.0(2y ago)05MITPHPPHP &gt;=5.6

Since Aug 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/5ar5kovic/laravel-jsend-response)[ Packagist](https://packagist.org/packages/petarpetkovic996/laravel-jsend-response)[ RSS](/packages/petarpetkovic996-laravel-jsend-response/feed)WikiDiscussions main Synced 1mo ago

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

Laravel JSend Response
======================

[](#laravel-jsend-response)

[![Laravel Package](https://camo.githubusercontent.com/b6dc78cc878ac9041c4567222060094e98367040fd81f05f3dc994935d1dce33/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d7061636b6167652d726564)](https://packagist.org/packages/petarpetkovic996/laravel-jsend-response)[![Latest Version on Packagist](https://camo.githubusercontent.com/803b8b2be12999c4125232902a25a06d8ef248acd71e560a173bfd8973154136/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7061636b61676973742d76312e302e302d626c75653f6c696e6b3d68747470733a2f2f7061636b61676973742e6f72672f7061636b616765732f70657461727065746b6f7669633939362f6c61726176656c2d6a73656e642d726573706f6e7365)](https://packagist.org/packages/petarpetkovic996/laravel-jsend-response)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](#)

This package defines JSend macros for the response in Laravel.

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

[](#installation)

You can install the package via Composer:

```
composer require petarpetkovic996/laravel-jsend-response
```

Usage
-----

[](#usage)

### Success

[](#success)

```
$data = [
    "first_name" => "Petar",
    "last_name" => "Petkovic"
];
return response()->success($data, 201);
```

Result

```
{
    "status": "success",
    "data": {
        "first_name": "Petar",
        "last_name": "Petkovic"
    }
}
```

With the HTTP `Status Code: 201`

### Fail

[](#fail)

```
$data = [
    'first_name' => 'A first_name is required'
    'last_name' => 'A last_name is required'
];
return response()->fail($data, 422);
```

Result

```
{
    "status": "fail",
    "data": {
        "first_name": "A first_name is required"
        "last_name": "A last_name is required"
    }
}
```

With the HTTP `Status Code: 422`

### Error

[](#error)

```
return response()->error('Unable to communicate with database', 500);
```

Result

```
{
    "status": "error",
    "message": "Unable to communicate with database"
}
```

With the HTTP `Status Code: 500`

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

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

1007d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/14345678456fa9cc6df6e5aee6fbcc02a3e377190b9816ac62c9671c5a27d10b?d=identicon)[5ar5kovic](/maintainers/5ar5kovic)

---

Top Contributors

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

---

Tags

responsephplaravelmacrosjsend5ar5kovic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/petarpetkovic996-laravel-jsend-response/health.svg)

```
[![Health](https://phpackages.com/badges/petarpetkovic996-laravel-jsend-response/health.svg)](https://phpackages.com/packages/petarpetkovic996-laravel-jsend-response)
```

###  Alternatives

[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[appstract/laravel-response-macros

Extra Response Macro's for Laravel

321.5k](/packages/appstract-laravel-response-macros)[werxe/laravel-collection-macros

Custom Laravel Collection macros.

2625.8k](/packages/werxe-laravel-collection-macros)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[salmanzafar/laravel-geocode

A Laravel Library to find Lat and Long of a given Specific Address

153.9k](/packages/salmanzafar-laravel-geocode)

PHPackages © 2026

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