PHP code example of kalider / phinx-tenant

1. Go to this page and download the library: Download kalider/phinx-tenant library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kalider / phinx-tenant example snippets



return [
    'type' => 'database', // database, array
    // if database type
    'database' => [
        'connection' => [
            'adapter' => 'mysql',
            'host' => 'localhost',
            'name' => 'multi_tenant_db',
            'user' => 'root',
            'pass' => 'kudabelang',
        ],
        'table' => 'tenants',
        'fields' => [
            'host' => 'host',
            'name' => 'name',
            'user' => 'user',
            'pass' => 'pass',
        ],
        // if wheres condition 
        'conditions' => [
            'status' => 1
        ]
    ],
    // if array type
    'tenants' => [
        [
            'host' => 'localhost',
            'name' => 'tenant1',
            'user' => 'root',
            'pass' => 'root',
        ],
    ]
];

bash
php vendor/bin/phinx-tenant migrate

# different phinx config
php vendor/bin/phinx-tenant migrate -c phinx-master.php