PHPackages                             bumip/json-schema-sql - 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. bumip/json-schema-sql

ActiveLibrary

bumip/json-schema-sql
=====================

Helper for converting json-schemas to sql create table statement

113PHP

Since Sep 8Pushed 5y agoCompare

[ Source](https://github.com/bumip/json-schema-sql)[ Packagist](https://packagist.org/packages/bumip/json-schema-sql)[ RSS](/packages/bumip-json-schema-sql/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

JSON Schema to SQL Tables
=========================

[](#json-schema-to-sql-tables)

This class converts a json-schema to a valid Sql table. Tested with MySql and Sqlite. A big shoutout to [@WebMaestroFr](https://github.com/WebMaestroFr) for this helper.

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

[](#installation)

Just run

```
composer require bumip/json-schema-sql dev-master
```

PHP
---

[](#php)

The php version is getting tested. Delete tests/database/dbtest.db to start testing

```
// Instanciate PDO
$pdo = new \PDO("mysql:dbname=example;host=localhost;port=3306", "user", "password");
// Instanciate JSON_Schema_MySQL
$sql_schema = new \Bumip\JsonSchema\JsonSchemaSql($pdo);

// Or, generate table from a single .json file
$sql_schema->createTableFromFile("path/to/schema.json");

## Shell
will be changed to a proper cli tool in the future.
`php -q /path/to/json-schema-mysql/json-schema-mysql.php "mysql:dbname=example;host=localhost;port=3306" "user" "password" "/path/to/json/schema/directory"`
```

CRUD Class **UNTESTED**
=======================

[](#crud-class-untested)

A CRUD class matching the DB architecture is available. **NOT TESTED**.

```
require_once "path/to/json-schema-mysql/json-schema-crud.php";
// Instanciate PDO
$pdo = new PDO("mysql:dbname=example;host=localhost;port=3306", "user", "password");
// Instanciate JSON_Schema_MySQL
$crud = new Schema_Model($pdo, "path/to/json/schema/directory");

// Get model by id
$model = $crud->my_schema($id);
// Create model
$model = $crud->my_schema->create([
    "column_1" => "Value one",
    "column_2" => "Value two"
]);
// Get model rows
$models = $crud->my_schema->read([
    "column_1" => "First filter",
    "column_2" => "Second filter"
], [
    "order_by" => "date",
    "order"    => "DESC",
    "limit"    => 24,
    "page"     => 0
]);
// Update model
$model = $crud->my_schema->update($model->id[
    "column_1" => "New value one",
    "column_2" => "New value two"
]);
// Delete model
$crud->my_schema->delete($model->id);
```

Feel free to whatever. Contributions are welcome.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 55% 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.

### Community

Maintainers

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

---

Top Contributors

[![WebMaestroFr](https://avatars.githubusercontent.com/u/1906973?v=4)](https://github.com/WebMaestroFr "WebMaestroFr (11 commits)")[![antocorr](https://avatars.githubusercontent.com/u/1094862?v=4)](https://github.com/antocorr "antocorr (9 commits)")

### Embed Badge

![Health badge](/badges/bumip-json-schema-sql/health.svg)

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

PHPackages © 2026

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