PHPackages                             mathsgod/json-to-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. [Database &amp; ORM](/categories/database)
4. /
5. mathsgod/json-to-sql

ActiveLibrary[Database &amp; ORM](/categories/database)

mathsgod/json-to-sql
====================

1.0.1(7mo ago)01371MITPHPPHP &gt;=8.1

Since Nov 12Pushed 6mo agoCompare

[ Source](https://github.com/mathsgod/json-to-sql)[ Packagist](https://packagist.org/packages/mathsgod/json-to-sql)[ RSS](/packages/mathsgod-json-to-sql/feed)WikiDiscussions main Synced today

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

JSON to SQL Converter
=====================

[](#json-to-sql-converter)

A PHP tool that converts database table definitions in JSON format to SQL CREATE TABLE statements.

Features
--------

[](#features)

- ✅ Batch conversion of multiple tables
- ✅ Support for complex field types and attributes
- ✅ Primary Key support
- ✅ Unique Key support
- ✅ Index support
- ✅ Foreign Key support
- ✅ AUTO\_INCREMENT support
- ✅ Storage engine configuration (InnoDB, etc.)
- ✅ Charset and Collation support

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Composer

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

[](#installation)

```
composer require mathsgod/json-to-sql
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

1. Create a `db.json` file in your project root with your table definitions (see [JSON Format Specification](#json-format-specification) below).
2. Create a `convert.php` script to use the converter:

```
