Yii 2.0: yii2-fmconnector

FileMaker ODBC connector and PHP-API integration

This extension allow you to use a FileMaker data source via an ODBC connection. It also includes a rewritten version of the PHP-API provided by FileMaker (without all deprecated warnings) to perform action over Custom Web Publishing.

As Filemaker doesn't handle primary/foreign keys, this connector will use you naming convention to detect them and let gii generates all the models & CRUD for you just like if you where using a standard SQL database. A Custom Gii models & CRUD generator is also included to improve default generated code.


  • airmoi/Filemaker (automatically included when installed from composer)

  • php_odbc extension enabled (as pdo_odbc is buggy with FileMaker ODBC Driver, PDO as been emulated in this extension)

  • ODBC Driver installed & a connection configured


To install, either run

$ php composer.phar require airmoi/yii2-fmconnector "*"

or add

"airmoi/yii2-fmconnector": "*"

to the require section of your composer.json file.


Create a db connection using this pattern

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_%',
             * 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) or name
            'foreignKeyPattern' => '/^(zkf|zkp)_([^_]*).*/', //pattern used to detect if a field is a foreign key

Tu use PHP-API, add these lines to your components configuration

    'components" => [
            'fmphelper' => [
                        'class' => 'airmoi\yii2fmconnector\api\FmpHelper',
                        'host' => 'localhost',
                        'db' => 'your_db_name',
                        'username' => '',
                        'password' => '',
                        'resultLayout' => 'PHP_scriptResult', //Layout used to return performScriptResult
                        'resultField' => 'PHP_scriptResult', //Field used in "resultLayout" to store script results
                        'valueListLayout' => 'PHP_valueLists', //Layout used to retrieve generic valueLists

Optionnaly, add these lines to your gii configuration

'generators' => [
                    'model' => [
                        'class' => 'yii\gii\generators\model\Generator',
                        'templates' => [
                            'FileMaker' => '@app/vendor/airmoi/yii2-fmconnector/gii/templates/',
                     'crud' => [ // generator name
                        'class' => 'airmoi\yii2fmconnector\gii\crud\Generator', // generator class


Just use db connection as every standard SQL db connection

call PHP-API this way



Be the first person to leave a comment

Please to leave your comment.

Create extension
No downloadable files yet