PHPackages                             papasmurf/laravel-4-jsend - 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. papasmurf/laravel-4-jsend

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

papasmurf/laravel-4-jsend
=========================

Laravel 4 standard JSON response format

3341PHP

Since Jun 2Pushed 10y ago1 watchersCompare

[ Source](https://github.com/papa-smurf/laravel-4-jsend)[ Packagist](https://packagist.org/packages/papasmurf/laravel-4-jsend)[ RSS](/packages/papasmurf-laravel-4-jsend/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Standardized JSON response with JSend
=====================================

[](#standardized-json-response-with-jsend)

According to OmniTI Labs @ :

JSend is a specification that lays down some rules for how JSON responses from web servers should be formatted. JSend focuses on application-level (as opposed to protocol- or transport-level) messaging which makes it ideal for use in REST-style applications and APIs.

Laravel (4.2)
-------------

[](#laravel-42)

### Installation

[](#installation)

Install this package through Composer by editing your `composer.json` file to require `papasmurf/laravel-4-jsend`.

```
"papasmurf/laravel-4-jsend": "dev-master"

```

Update Composer from the Terminal / Command-line:

```
composer update

```

Once done add the service provider to `app/config/app.php`

```
'Papasmurf\JSend\JSendServiceProvider',

```

After that you are free to add the facade to your list of aliases in `app/config/app.php`

```
'JSend' => 'Papasmurf\JSend\Facades\JSend',

```

All set and done! You can now respond with consistent JSON messages without having to think of the ideal JSON format..ever!

### Usage

[](#usage)

```
function doStuff()
{
	return JSend::success([
		'redirect' => URL::action('UsersController@index')
	]);
}

function validateStuff()
{
	return JSend::fail([
		'failed' => $validation->failedFields(),
		'message' => $message
	]);
}

function tryStuff()
{
	try {
		stuff();
	} catch (Exception $e) {
		return JSend::error('whoops!');
	}

	return JSend::success();
}
```

Standalone
----------

[](#standalone)

Standalone usage is possible as well and requires a Response object with a json method:

```
require __DIR__ . '/src/JSend.php';

class Response
{
	public function json($data)
	{
		return json_encode($data);
	}
}

$responder = new Response;
$JSend = new Papasmurf\JSend\JSend($responder);

echo $JSend->success([
    'redirect' => 'mydomain.com/something'
]);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/62bb2d236c27124b54947557a469f1d0ad2ec4aaf8f097b32a621605804ab894?d=identicon)[papasmurf](/maintainers/papasmurf)

---

Top Contributors

[![papa-smurf](https://avatars.githubusercontent.com/u/4224975?v=4)](https://github.com/papa-smurf "papa-smurf (16 commits)")

### Embed Badge

![Health badge](/badges/papasmurf-laravel-4-jsend/health.svg)

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

###  Alternatives

[bcc/auto-mapper-bundle

An object to object mapper bundle for Symfony2

63442.7k](/packages/bcc-auto-mapper-bundle)[fgits/carbon-german-holidays

Carbon extension with support for German Holidays

1252.4k](/packages/fgits-carbon-german-holidays)

PHPackages © 2026

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