PHPackages                             sokil/php-json-schema-defaults - 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. sokil/php-json-schema-defaults

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

sokil/php-json-schema-defaults
==============================

Extracting default value from JSON Schema

0.1.0(3y ago)01.2kMITPHPPHP ^8.1

Since Apr 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sokil/php-json-schema-defaults)[ Packagist](https://packagist.org/packages/sokil/php-json-schema-defaults)[ RSS](/packages/sokil-php-json-schema-defaults/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

JSON Schema Defaults
====================

[](#json-schema-defaults)

[![Coverage Status](https://camo.githubusercontent.com/6697047226eabb3d6bb3d9f3d817ffe5a59b31901b53ea9c878cd6a22b8fa9d4/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f736f6b696c2f7068702d6a736f6e2d736368656d612d64656661756c74732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/sokil/php-json-schema-defaults?branch=master)[![ci](https://github.com/sokil/php-json-schema-defaults/actions/workflows/ci.yml/badge.svg)](https://github.com/sokil/php-json-schema-defaults/actions/workflows/ci.yml)

Extracting default value from JSON Schema.

Supports drafts from v.7 or its dialects. Extractor trusts that passed schema is valid, so perform external validation for it.

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

[](#installation)

```
composer req sokil/php-json-schema-defaults

```

Usage
-----

[](#usage)

```
$schema = '{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "array",
    "items": {"type": "string", "default": "hello"}
}';

$extractor = new Extractor();
$defaultValue = $extractor->extract($schema); // ["hello"]
```

Console command
---------------

[](#console-command)

To get default value from schema in console use next bin:

```
./vendor/bin/json-schema-defaults ~/path/to/schema.json

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

1136d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/902e21ecf6517341b1f2a3c2f93a3eb115396fc6524effaeabc816b481909e64?d=identicon)[sokil](/maintainers/sokil)

---

Top Contributors

[![sokil](https://avatars.githubusercontent.com/u/1829948?v=4)](https://github.com/sokil "sokil (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sokil-php-json-schema-defaults/health.svg)

```
[![Health](https://phpackages.com/badges/sokil-php-json-schema-defaults/health.svg)](https://phpackages.com/packages/sokil-php-json-schema-defaults)
```

PHPackages © 2026

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