PHP code example of airmoi / yii2-fmconnector

1. Go to this page and download the library: Download airmoi/yii2-fmconnector 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/ */

    

airmoi / yii2-fmconnector example snippets


return [
    'class' => 'airmoi\yii2fmconnector\db\Connection',
    'dsn' => 'fmp:<odbc_connection_name>',
    'username' => '<odbc_username>',
    'password' => '<odbc_username>',
    'charset' => 'utf8',
    'pdoClass' => 'airmoi\yii2fmconnector\db\PDO',
    //'enableSchemaCache' => true,
    //'schemaCacheDuration' => 86400,
    //'enableQueryCache' => true,
    //'queryCacheDuration' => 1000,
    'schemaMap' => ['fmp' => [
            'class' => 'airmoi\yii2fmconnector\db\Schema',
            /* 
             * Customize this option to ignore specific fields (like global/utils fields) which you don't want to get access
             * Ignore theses fields improve query performences
             */
            'ignoreFields' => [
                'FieldType' => ['global%'],
                'FieldClass' => ['Summary'],
                'FieldName' => ['zkk_%',
                    'zgi_%',
                    'zg_%',
                    'zz_%',
                    'zzz_%',
                    'zlg_%',
                    'z_foundCount_cU',
                    'z_listOf_eval_cU',
                ]
            ],
            /* 
             * Regexp pattern used to detect if a field is a primary key
             * this pattern while be used against fields names
             */
            'primaryKeyPattern' => '/^zkp(_)?/',
            /* 
             * pattern used to detect if a field is a foreign key
             * this pattern while be used against fields names
             * Second match of the pattern must return the foreign key trigram (XXX)
             */
            'foreignKeyPattern' => '/^(zkf|zkp)_([^_]*).*/', //pattern used to detect if a field is a foreign key
        ]
    ]
];

'generators' => [
        'model' => [
        'class' => 'yii\gii\generators\model\Generator',
        'templates' => [
            'FileMakerAPI' => '@app/vendor/airmoi/yii2-fmconnector/gii/api/templates/',
            'FileMakerODBC' => '@app/vendor/airmoi/yii2-fmconnector/gii/odbc/templates/',
        ]
    ],
     'crud' => [ // generator name
        'class' => 'airmoi\yii2fmconnector\gii\api\crud\Generator', // generator class
        /*'templates' => [ //setting for out templates
            'myCrud' => '@app/myTemplates/crud/default', // template name => path to template
        ]*/
    ]
],

php composer.phar