PHPackages                             jbuilder/common - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. jbuilder/common

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

jbuilder/common
===============

This is a library for creating the structure of the JSON for PHP 5.4+

1.0.0(12y ago)1330.7k↓50%2MITPHPPHP &gt;=5.4

Since May 21Pushed 12y ago1 watchersCompare

[ Source](https://github.com/dakatsuka/JBuilder)[ Packagist](https://packagist.org/packages/jbuilder/common)[ RSS](/packages/jbuilder-common/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

JBuilder for PHP [![Build Status](https://camo.githubusercontent.com/75a0933f62a55e181069993e96256c3fa31a4480e6b44f6c883f4e2594930b46/68747470733a2f2f7472617669732d63692e6f72672f64616b617473756b612f4a4275696c6465722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/dakatsuka/JBuilder)
======================================================================================================================================================================================================================================================================================================

[](#jbuilder-for-php-)

This is a library for creating the structure of the JSON for PHP.

```
use JBuilder\Common\Encoder;

echo Encoder::encode(function($json) use ($comments) {
    $json->title = "This is a pen";
    $json->created_at = (new \DateTime())->format(\DateTime::ISO8601);
    $json->updated_at = (new \DateTime())->format(\DateTime::ISO8601);

    $json->author(function($json) {
        $json->name  = "Dai Akatsuka";
        $json->email = "d.akatsuka@gmail.com";
        $json->url   = "https://github.com/dakatsuka";
    });

    $json->comments($comments, function($json, $comment) {
        $json->content    = $comment->getContent();
        $json->created_at = $comment->getCreatedAt();
    });
});
```

This will build the following structure:

```
{
  "title": "This is a pen",
  "created_at": "2013-05-21T16:49:37+0900",
  "updated_at": "2013-05-21T16:49:37+0900",

  "author": {
    "name": "Dai Akatsuka",
    "email": "d.akatsuka@gmail.com",
    "url": "https://github.com/dakatsuka"
  },

  "comments": [
    {
      "content": "Hello! Great!",
      "created_at": "2013-05-21T16:49:37+0900"
    },
    {
      "content": "Hello! Great!",
      "created_at": "2013-05-21T16:49:37+0900"
    }
  ]
}
```

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

[](#installation)

Add this lines to your composer.json:

```
{
    "require": {
        "jbuilder/common": "dev-master"
    }
}
```

And then execute:

```
$ php composer.phar install
```

Contributing
------------

[](#contributing)

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Copyright
---------

[](#copyright)

Copyright (C) 2013 Dai Akatsuka, released under the MIT License.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4744d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c14404a98a46334c9131aa4f6f071bd6b4b279670eb0e74d27d39104e12c1a3b?d=identicon)[dakatsuka](/maintainers/dakatsuka)

---

Top Contributors

[![dakatsuka](https://avatars.githubusercontent.com/u/59034?v=4)](https://github.com/dakatsuka "dakatsuka (15 commits)")

---

Tags

jsonlibrary

### Embed Badge

![Health badge](/badges/jbuilder-common/health.svg)

```
[![Health](https://phpackages.com/badges/jbuilder-common/health.svg)](https://phpackages.com/packages/jbuilder-common)
```

###  Alternatives

[justinrainbow/json-schema

A library to validate a json schema.

3.6k316.9M612](/packages/justinrainbow-json-schema)[ergebnis/json-normalizer

Provides generic and vendor-specific normalizers for normalizing JSON documents.

8237.5M6](/packages/ergebnis-json-normalizer)[thunderer/serializard

Flexible serializer

2767.3k1](/packages/thunderer-serializard)[hamlet-framework/json-mapper

Json Data Binding

2711.9k](/packages/hamlet-framework-json-mapper)[phppkg/config

Config manage, load, get. Supports INI,JSON,YAML,NEON,PHP format file

133.5k](/packages/phppkg-config)[opensoft/simple-serializer

Simple Serializer

1914.2k1](/packages/opensoft-simple-serializer)

PHPackages © 2026

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