PHPackages                             alle/kohana-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. alle/kohana-jsend

AbandonedArchivedKohana-module

alle/kohana-jsend
=================

JSend model for Kohana 3.3 (consistent JSON responses)

1577PHP

Since Jan 7Pushed 12y agoCompare

[ Source](https://github.com/alle/kohana-jsend)[ Packagist](https://packagist.org/packages/alle/kohana-jsend)[ RSS](/packages/alle-kohana-jsend/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Kohana JSend module
===================

[](#kohana-jsend-module)

### Author: Kemal Delalic

[](#author-kemal-delalic)

See:

### Example multiple scenario action

[](#example-multiple-scenario-action)

```
public function action_create()
{
	$json = new JSend;
	$post = new Model_Post;

	if ($this->request->method() === Request::POST)
	{
		try
		{
			$post->values($this->request->post())
				->create();

			$json->data('post', $post); // success is default anyways
		}
		catch (ORM_Validation_Exception $e)
		{
			// Errors are extracted
			// from ORM_Validation_Exception objects
			$json->status(JSend::FAIL)
				->data('errors', $e);
		}
		catch (Exception $e)
		{
			// Exception message will be extracted
			// and status will be set to JSend::ERROR
			// because only error responses support messages
			$json->message($e);
		}
	}

	$json->render_into($this->response);
}

```

### Example data retrieval action

[](#example-data-retrieval-action)

```
public function action_posts()
{
	// Success is the default JSend status
	JSend::factory(array('posts' => ORM::factory('post')->find_all()))
		->render_into($this->response);
}

```

### Example jQuery response handling

[](#example-jquery-response-handling)

```
$.post('/posts', {from: 1337}, function(jsend) {
	if (jsend.status === 'success') {
		$.each(jsend.data.posts, function(key, post) {
			$('#posts').append('' + post.title + '')
		})
	}
	else if (jsend.status === 'fail') {
		$.each(jsend.data.errors, function(field, error) {
			$('#form').find('#' + field).append('' + error + '')
		})
	}
	else {
		$('#posts').addClass('error').text('Internal error: ' + post.message)
	}
});

```

This can also be overriden on more 'global' level, by overriding or adding jQuery methods.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.1% 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/3c8c7b57aced7929769b2305f300857977a609006bea346cf1c2d85a17b1d174?d=identicon)[alle](/maintainers/alle)

---

Top Contributors

[![kemo](https://avatars.githubusercontent.com/u/100160?v=4)](https://github.com/kemo "kemo (54 commits)")[![alle](https://avatars.githubusercontent.com/u/122359?v=4)](https://github.com/alle "alle (4 commits)")

### Embed Badge

![Health badge](/badges/alle-kohana-jsend/health.svg)

```
[![Health](https://phpackages.com/badges/alle-kohana-jsend/health.svg)](https://phpackages.com/packages/alle-kohana-jsend)
```

PHPackages © 2026

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