Convert nested array to multiple flat arrays

I don’t found here a solution for my problem. Because of this, here my issue:
I have an array of some parameters (like a YAML config file) and this need to be written to database finaly with primary ids and so on.

For example this is a part of my array:

$settings = [
'basic' => [                       // first level category
    'installation_type' => [       // setting parameter with parameter attributes
        'type' => '["single","cluster"]',
        'description' => 'bla blah',
        'readonly' => false,
        'hidden' => false,
        'trigger' => null,
        'default' => 'single'
    ],
    'db_master_host' => [
        'type' => 'ip',
        'description' => 'Database hostname or IP',
        'default' => 'localhost'
    ],
    'db_master_user' => [
        'type' => 'text',
        'description' => 'Database username',
        'default' => 'test'
    ],
    'db_master_pwd' => [
        'type' => 'secret',
        'description' => 'Database user password',
    ],
    'db_master_db' => [
        'type' => 'text',
        'description' => 'Database name',
        'default' => 'test'
    ]
],
'provisioning' => [         // first level category
    'snom' => [             // second level category
        'snom_prov_enabled' => [
            'type' => 'switch',
            'default' => false
        ],
        'snom_m3' => [
            'snom_m3_accounts' => [
                'type' => 'number',
                'description' => 'bla blah',
                'default' => '0'
            ]
        ],
        'snom_dect' => [
            'snom_dect_enabled' => [
                'type' => 'switch',
                'description' => 'bla blah',
                'default' => false
            ]
        ]
    ],
    'yealink' => [
        'yealink_prov_enabled' => [
            'type' => 'switch',
            'default' => false
        ]
    ]
],

];

As result I need some arrays like images of database tables (category, setting, value) with self-generated IDs:

$category["basic"] = [id: 1, parent: 0, name: "basic", order: 1]
$setting["installation_type"] = [id: 1, catId: 1, name: "installation_type", type: '["single","cluster"]', desc: 'asd', order: 1]
$value["installation_type"] = [id: 1, setId: 1, default: 'single']
$setting["db_master_host"] = [id: 2, catId: 1, name: "db_master_host", type: 'ip', desc: 'asd', order: 2]
$value["db_master_host"] = [id: 2, setId: 2, name: "db_master_host", default: 'localhost']
...
$category["provisioning"] = [id: 2, parent: 0, name: "provisioning", order: 2]
$category["snom"] = [id: 3, parent: 2, name: "snom", order: 3]
...

I hope my problem is understandable here and anyone could help me.