PHPackages                             drez/hjson-to-propel-xml - 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. drez/hjson-to-propel-xml

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

drez/hjson-to-propel-xml
========================

Convert JSON for Humans (HJSON) to Propel XML Schema.

v1.0(5y ago)281MITPHPPHP &gt;=5.6

Since Sep 15Pushed 1y ago2 watchersCompare

[ Source](https://github.com/drez/hjson-to-propel-xml)[ Packagist](https://packagist.org/packages/drez/hjson-to-propel-xml)[ Docs](https://github.com/drez/HjsonToPropelXml)[ RSS](/packages/drez-hjson-to-propel-xml/feed)WikiDiscussions master Synced yesterday

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

A better way to build Propel with HJSON Schema
==============================================

[](#a-better-way-to-build-propel-with-hjson-schema)

This is a library to convert HJSON file to Propel XML schema. I always found Propel() schema tedious to write. This should help make it more approchable.

Install with composer
=====================

[](#install-with-composer)

```
composer require drez/hjson-to-propel-xml

```

Live converter
==============

[](#live-converter)

Example
=======

[](#example)

Now you can write that:

```
{
    // database name
    goatcheese:
    {
        // custom behavior, not parameter
        add_validator:true,

        // timestamp behavior
        table_stamp_behavior:true,

        /* parameters for the APIgoat behavior from here, configurable custom behaviors shortcuts */
        set_debug_level:3,
        is_builder:true,
        add_hooks:{},
        with_api:true,
        /* to here */

        // table name='authy' decription='User'
        "authy('User')":{

            // parameters from the APIgoat behavior
            set_parent_menu:"Settings",

            // Primary column name=id_authy primaryKey=true autoincrement=true
            id_authy:["primary"],

            // default string column type=VARCHAR size=50
            validation_key:"string(32)",

            // Unique markup will be added for the table
            "username(Username)":["string(32)", "not-required", "unique"],

            // set the defaultValue=No
            is_root(Root):["enum(Yes, No)", "default:No"],

            // Add a default colunm, type=integer and add the foreign-key markup
            id_authy_group:["foreign(authy_group)", "required"],
            expire(Expiration): ["date()"]
        },
        authy_group_x:
        {
            // cross reference table, will add isCrossRef=true to the table
            is_cross_ref:true,

            // change the default settings on the foreign key
            id_authy:["foreign(authy)", "primary", "onDelete:cascade"],

            id_authy_group:["foreign(authy_group)", "primary"],
        }
    }
}

```

will translate to:

```

```

USE
===

[](#use)

```
$text = file_get_contents($this->rootDir . DIRECTORY_SEPARATOR . $hjson_file);

// make sure we have unix style text regardless of the input
$std = mb_ereg_replace('/\r/', "", $text);
$hjson = $cr ? mb_ereg_replace("\n", "\r\n", $std) : $std;

// use of laktak/hjson(https://github.com/hjson/hjson-php) to convert the HJSON to array
$parser = new \HJSON\HJSONParser();
$obj = $parser->parse($hjson, ['assoc' => true]);

// convert Hjson to Propel schema
$HjsonToXml = new \HjsonToPropelXml\HjsonToPropelXml();
$HjsonToXml->convert($obj);

```

Schema
======

[](#schema)

- You can use all Propel column type
- You can specify any Propel column attributes as attribut:value
- You are encouraged to add your own shortcuts for the most used type!

TODO
====

[](#todo)

- Make more keyword shortcut (String(32)), and find the best defaults!
- Propel validations
- Add table validations, warn on potential problems
- Add custom behavior validations
- Tests

License
-------

[](#license)

MIT

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

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

Unknown

Total

1

Last Release

2064d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1502671?v=4)[Fred](/maintainers/drez)[@drez](https://github.com/drez)

---

Top Contributors

[![drez](https://avatars.githubusercontent.com/u/1502671?v=4)](https://github.com/drez "drez (48 commits)")

---

Tags

hjsonphppropelpropel2schemajsonconfigparserpropelhumanhjson

### Embed Badge

![Health badge](/badges/drez-hjson-to-propel-xml/health.svg)

```
[![Health](https://phpackages.com/badges/drez-hjson-to-propel-xml/health.svg)](https://phpackages.com/packages/drez-hjson-to-propel-xml)
```

###  Alternatives

[laktak/hjson

JSON for Humans. A configuration file format with relaxed syntax, fewer mistakes and more comments.

86233.7k12](/packages/laktak-hjson)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[salsify/json-streaming-parser

A streaming parser for JSON in PHP.

7766.7M15](/packages/salsify-json-streaming-parser)[cerbero/json-parser

Zero-dependencies pull parser to read large JSON from any source in a memory-efficient way.

803474.6k5](/packages/cerbero-json-parser)[pcrov/jsonreader

JSON Pull Parser

1451.2M5](/packages/pcrov-jsonreader)[bcncommerce/json-stream

A bundle of tools to work with JSON in PHP

642.2M3](/packages/bcncommerce-json-stream)

PHPackages © 2026

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