PHPackages                             buagern/slim-json - 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. [Templating &amp; Views](/categories/templating)
4. /
5. buagern/slim-json

ActiveLibrary[Templating &amp; Views](/categories/templating)

buagern/slim-json
=================

JSON middleware for Slim PHP framework

0.1.2(11y ago)031MITPHPPHP &gt;=5.4.0

Since Mar 2Pushed 11y ago1 watchersCompare

[ Source](https://github.com/buagern/slim-json)[ Packagist](https://packagist.org/packages/buagern/slim-json)[ Docs](https://github.com/buagern/slim-json)[ RSS](/packages/buagern-slim-json/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

SlimJson
========

[](#slimjson)

[![Latest Version](https://camo.githubusercontent.com/c9a1ac65c5fe4c5eef716c41cff0c457e0e5d68c7045f14fe65c30d817e0c482/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6275616765726e2f736c696d2d6a736f6e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/buagern/slim-json/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/ca25ff4bdd2589b31d5b934346910e0d38fba6dccb9d572d636c4b24f8b945fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6275616765726e2f736c696d2d6a736f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/buagern/slim-json)

This is an extension to the [Slim Framework](https://github.com/codeguy/Slim) to implement JSON output.

Install
-------

[](#install)

Via Composer

```
$ composer require buagern/slim-json
```

or adding this line to your composer.json file

```
"buagern/slim-json": "0.1.*"
```

Usage
-----

[](#usage)

To include the middleware and view you just have to load them using the default *Slim* way. Read more about Slim Here ()

```
require 'vendor/autoload.php';

$app = new \Slim\Slim();

$app->view(new \Buagern\SlimJson\View);
$app->add(new \Buagern\SlimJson\Middleware);
```

### Using Routing Middleware method

[](#using-routing-middleware-method)

```
function jsonResponse()
{
    $app = \Slim\Slim::getInstance();
    $app->view(new \Buagern\SlimJson\View);
    $app->add(new \Buagern\SlimJson\Middleware);
}

$app->get('/', function () use ($app)
{
    // normal view render

    return $app->render('view.php');
});

$app->get('/json', 'jsonResponse', function () use ($app)
{
    // this request will return json response

    return $app->render(200, [
        'message' => 'JSON response',
    ]);
});
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Settawat Jamsai](https://github.com/buagern)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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 ~19 days

Total

2

Last Release

4075d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ce0414d1c36f229706e78f63ec4f58a8602d67b84af0da9366255bf3f175b88?d=identicon)[buagern](/maintainers/buagern)

---

Top Contributors

[![buagern](https://avatars.githubusercontent.com/u/294881?v=4)](https://github.com/buagern "buagern (14 commits)")

---

Tags

jsonmiddlewareslimview

### Embed Badge

![Health badge](/badges/buagern-slim-json/health.svg)

```
[![Health](https://phpackages.com/badges/buagern-slim-json/health.svg)](https://phpackages.com/packages/buagern-slim-json)
```

###  Alternatives

[entomb/slim-json-api

Slim extension to implement fast JSON API's

268156.4k4](/packages/entomb-slim-json-api)[dogancelik/slim-json

JSON middleware for Slim PHP framework

3984.0k3](/packages/dogancelik-slim-json)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7526.3M230](/packages/laminas-laminas-view)[shoot/shoot

Shoot aims to make providing data to your templates more manageable

40229.9k2](/packages/shoot-shoot)[petebrowne/slim-layout-view

A Custom View supporting Layouts for the Slim Framework.

3518.0k](/packages/petebrowne-slim-layout-view)[davidepastore/slim-config

A slim middleware to read configuration from different files based on hassankhan/config

338.9k1](/packages/davidepastore-slim-config)

PHPackages © 2026

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