PHPackages                             neophp/jsonformatter-package - 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. neophp/jsonformatter-package

ActiveLibrary

neophp/jsonformatter-package
============================

Dev-only JSON formatter, minifier, and validator for NeoPHP

v0.2.0(yesterday)02↑2900%MITJavaScriptPHP &gt;=8.5CI passing

Since Aug 8Pushed yesterdayCompare

[ Source](https://github.com/NeoPHP-Dev/neo-jsonformatter-package)[ Packagist](https://packagist.org/packages/neophp/jsonformatter-package)[ RSS](/packages/neophp-jsonformatter-package/feed)WikiDiscussions main Synced today

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

JsonFormatter Package
=====================

[](#jsonformatter-package)

A dev-only JSON formatter for NeoPHP. Paste raw JSON, format it, minify it, or get a precise validation error — entirely client-side, with live validation as you type.

---

Structure
---------

[](#structure)

```
jsonformatter-package/
├── composer.json
├── README.md
└── src/
    ├── NeoJsonFormatterPackage.php
    ├── Middleware/
    │   └── DevOnlyMiddleware.php
    ├── Controllers/
    │   └── JsonFormatterController.php
    ├── Assets/
    │   ├── css/jsonformatter.css
    │   └── js/jsonformatter.js
    └── Templates/
        ├── components/
        │   └── JsonFormatter.macro.html.twig
        └── pages/
            └── formatter.html.twig

```

---

Dev-only, by design
-------------------

[](#dev-only-by-design)

The standalone page's route is protected by `DevOnlyMiddleware`, checking `Config/app.config.php`'s `environment` key. Outside `environment: dev`, it returns a blocked response.

The `JsonFormatter` macro makes no server calls, so it has no such restriction built in — guard any page you embed it in yourself if it should stay dev-only in your project.

---

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

[](#installation)

```
php bin/neo package:require neophp/jsonformatter-package --project=MyProject
```

Register it in the project's `Config/app.config.php`:

```
return [
    // ...
    'packages' => [
        \Vendor\NeoPHP\JsonFormatterPackage\NeoJsonFormatterPackage::class,
    ],
];
```

No configuration file, no migration.

---

Usage
-----

[](#usage)

### Standalone page

[](#standalone-page)

Visit `/_jsonformatter/` (only reachable in `dev`). Paste JSON, click **Format** or **Minify**. The text is validated as you type — an invalid JSON string shows an error with the approximate line/column where parsing failed.

### Embedding in your own page

[](#embedding-in-your-own-page)

```
{% import '@JsonFormatter/components/JsonFormatter.macro.html.twig' as JsonFormatter %}

{{ JsonFormatter.render() }}

```

`JsonFormatter.render(instanceId = 'jf')` accepts an optional `instanceId` to avoid collisions if rendered more than once on the same page.

---

What it provides
----------------

[](#what-it-provides)

- **Format** — re-indents JSON with 4-space indentation
- **Minify** — collapses JSON to a single line, no whitespace
- **Live validation** — as you type, invalid JSON is flagged immediately with an error message, including an approximate line/column when the browser's JSON parser exposes one
- **Byte size** — shows the current text's size in bytes, useful to see how much minifying actually saves

---

Theming
-------

[](#theming)

Every visual value is a CSS custom property scoped to `.jf-layout`:

```
.jf-layout {
    --jf-accent: #6366f1;
    --jf-bg: #161923;
    --jf-bg-alt: #1b2030;
    --jf-border: #2d3342;
    --jf-text: #e5e7eb;
    --jf-text-muted: #9ca3af;
}
```

---

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~0 days

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/212323688?v=4)[BBoezio](/maintainers/BenjiLeLoustik)[@BenjiLeLoustik](https://github.com/BenjiLeLoustik)

---

Top Contributors

[![BenjiLeLoustik](https://avatars.githubusercontent.com/u/212323688?v=4)](https://github.com/BenjiLeLoustik "BenjiLeLoustik (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

### Embed Badge

![Health badge](/badges/neophp-jsonformatter-package/health.svg)

```
[![Health](https://phpackages.com/badges/neophp-jsonformatter-package/health.svg)](https://phpackages.com/packages/neophp-jsonformatter-package)
```

PHPackages © 2026

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