{"id":20336636,"url":"https://github.com/myfmbutler/myfmapilibrary-for-php","last_synced_at":"2025-04-11T22:41:03.445Z","repository":{"id":37885497,"uuid":"136040135","full_name":"myFMbutler/myFMApiLibrary-for-PHP","owner":"myFMbutler","description":"A wrapper in PHP to use the FileMaker Data API","archived":false,"fork":false,"pushed_at":"2021-07-05T10:15:43.000Z","size":46,"stargazers_count":20,"open_issues_count":3,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T10:27:59.458Z","etag":null,"topics":["api","composer","filemaker","php","wrapper"],"latest_commit_sha":null,"homepage":"https://www.lesterius.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/myFMbutler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-04T14:48:31.000Z","updated_at":"2024-03-28T19:01:46.000Z","dependencies_parsed_at":"2022-08-20T00:11:49.016Z","dependency_job_id":null,"html_url":"https://github.com/myFMbutler/myFMApiLibrary-for-PHP","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myFMbutler%2FmyFMApiLibrary-for-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myFMbutler%2FmyFMApiLibrary-for-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myFMbutler%2FmyFMApiLibrary-for-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myFMbutler%2FmyFMApiLibrary-for-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myFMbutler","download_url":"https://codeload.github.com/myFMbutler/myFMApiLibrary-for-PHP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493022,"owners_count":21113159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","composer","filemaker","php","wrapper"],"created_at":"2024-11-14T21:06:13.747Z","updated_at":"2025-04-11T22:41:03.421Z","avatar_url":"https://github.com/myFMbutler.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Lesterius (Claris) FileMaker 19 Data API wrapper - myFMApiLibrary for PHP\n=======================\n\n# Presentation\n\n## Team\n[Lesterius](https://www.lesterius.com \"Lesterius\") is a European Claris (FileMaker) Business Alliance Platinum member that operates in Belgium, France, the Netherlands, Portugal and Spain. We are creative business consultants who co-create FileMaker Platform based solutions with our customers.\\\nSharing knowledge takes part of our DNA, that's why we developed this library to make the FileMaker Data API easy-to-use with PHP.\\\nBreak the limits of your application!\\\n![Lesterius logo](http://i1.createsend1.com/ei/r/29/D33/DFF/183501/csfinal/Mailing_Lesterius-logo.png \"Lesterius\")\n\n## Description\nThis library is a PHP wrapper of the (Claris) FileMaker Data API 19.\u003cbr/\u003e\n\nYou can find the PHP wrapper of the FileMaker Data API 17 on the releases \u003c= v.1.* .\u003cbr/\u003e\nYou can find the PHP wrapper of the FileMaker Data API 18 on the releases \u003c= v.2.* .\u003cbr/\u003e\n\nYou will be able to use every functions like it's documented in your FileMaker server Data Api documentation (accessible via https://[your server domain]/fmi/data/apidoc).\nGeneral Claris document on the Data API is available [here](https://help.claris.com/en/data-api-guide/)\n\n## Requirements\n\n- PHP \u003e= 5.5\n- PHP cURL extension\n- PHP mb_string extension\n\n## Installation\n\nThe recommended way to install it is through [Composer](http://getcomposer.org).\n\n```bash\ncomposer require myfmbutler/myfmapilibrary-for-php\n```\n\nAfter installing, you need to require Composer's autoloader:\n\n```php\nrequire_once __DIR__ . '/vendor/autoload.php';\n```\n\n# Usage\n\n## Prepare your Claris (Filmaker) solution\n\n1. Enable the (Claris) FileMaker Data API option on your FileMaker server admin console.\n2. Create a specific user in your (Claris) FileMaker database with the 'fmrest' privilege\n3. Define records \u0026 layouts access for this user\n\n## Use the library\n\n### Login\n\nLogin with credentials:\n```php\n$dataApi = new \\Lesterius\\FileMakerApi\\DataApi('https://test.fmconnection.com/fmi/data', 'MyDatabase', null, 'filemaker api user', 'filemaker api password');\n```\n\nLogin with oauth:\n```php\n$dataApi = new \\Lesterius\\FileMakerApi\\DataApi('https://test.fmconnection.com/fmi/data', 'MyDatabase', null, null, true, 'oAuthRequestId', 'oAuthIdentifier');\n```\n\n### Logout\n\n```php\n\n$dataApi-\u003elogout();\n```\n\n### Validate Session\n\n```php\n\n$dataApi-\u003evalidateSession();\n```\n\n### Create record\n\n```php\n\n$data = [\n    'FirstName'         =\u003e 'John',\n    'LastName'          =\u003e 'Doe',\n    'email'             =\u003e 'johndoe@acme.inc',\n    'RepeatingField(1)' =\u003e 'Test'\n];\n\n$scripts = [\n    [\n        'name'  =\u003e 'ValidateUser',\n        'param' =\u003e 'johndoe@acme.inc',\n        'type'  =\u003e Lesterius\\FileMakerApi\\DataApi::SCRIPT_PREREQUEST\n    ],\n    [\n        'name'  =\u003e 'SendEmail',\n        'param' =\u003e 'johndoe@acme.inc',\n        'type'  =\u003e Lesterius\\FileMakerApi\\DataApi::SCRIPT_POSTREQUEST\n    ]\n];\n\n$portalData = [\n  'portalName or OccurenceName' =\u003e [\n      [\n          \"Occurence::PortalField 1\" =\u003e \"Value\",\n          \"Occurence::PortalField 2\" =\u003e \"Value\",\n      ]\n  ]\n];\n\ntry {\n    $recordId = $dataApi-\u003ecreateRecord('layout name', $data, $scripts, $portalData);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Delete record\n\n```php\n\ntry {\n  $dataApi-\u003edeleteRecord('layout name', $recordId, $script);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Edit record\n\n```php\n\ntry {\n  $recordId = $dataApi-\u003eeditRecord('layout name', $recordId, $data, $lastModificationId, $portalData, $scripts);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Duplicate record\n\n```php\n\ntry {\n  $recordId = $dataApi-\u003eeditRecord('layout name', $recordId, $scripts);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Get record\n\n```php\n\n$portals = [\n    [\n        'name'  =\u003e 'Portal1',\n        'limit' =\u003e 10\n    ],\n    [ \n        'name'   =\u003e 'Portal2',\n        'offset' =\u003e 3\n    ]\n];\n\ntry {\n  $record = $dataApi-\u003egetRecord('layout name', $recordId, $portals, $scripts);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Get records\n\n```php\n\n$sort = [\n    [\n        'fieldName' =\u003e 'FirstName',\n        'sortOrder' =\u003e 'ascend'\n    ],\n    [\n        'fieldName' =\u003e 'City',\n        'sortOrder' =\u003e 'descend'\n    ]\n];\n\ntry {\n  $record = $dataApi-\u003egetRecords('layout name', $sort, $offset, $limit, $portals, $scripts);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Find records\n\n```php\n\n$query = [\n    [\n        'fields'  =\u003e [\n            ['fieldname' =\u003e 'FirstName', 'fieldvalue' =\u003e '==Test'],\n            ['fieldname' =\u003e 'LastName', 'fieldvalue' =\u003e '==Test'],\n        ],\n        'options' =\u003e [\n            'omit' =\u003e false\n        ]\n    ]\n];\n\ntry {\n  $results = $dataApi-\u003efindRecords('layout name', $query, $sort, $offset, $limit, $portals, $scripts, $responseLayout);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Set global fields\n\n```php\n\n$data = [\n  'FieldName1'\t=\u003e 'value',\n  'FieldName2'\t=\u003e 'value'\n];\n\ntry {\n  $dataApi-\u003esetGlobalFields('layout name', $data);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Execute script\n\n```php\n\n\ntry {\n  $dataApi-\u003eexecuteScript('script name', $scriptsParams);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Upload file to container\n\n#### Renaming file\n```php\n\n$containerFieldName       = 'Picture';\n$containerFieldRepetition = 1;\n// replace 'upload' below with the name=\"value\" of the file input element of your web form\n$filepath                 = $_FILES['upload']['tmp_name'];\n$filename                 = $_FILES['upload']['name'];\n\ntry {\n  $dataApi-\u003euploadToContainer('layout name', $recordId, $containerFieldName, $containerFieldRepetition, $filepath, $filename);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n#### Without checking filename\n```php\n\n$containerFieldName       = 'Picture';\n$containerFieldRepetition = 1;\n$filepath                 = '/usr/home/acme/pictures/photo.jpg';\n\ntry {\n  $dataApi-\u003euploadToContainer('layout name', $recordId, $containerFieldName, $containerFieldRepetition, $filepath);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n### Metadata Info\n\n#### Product Info\n```php\n\ntry {\n  $dataApi-\u003egetProductInfo();\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n#### Database Names\n```php\n\ntry {\n  $dataApi-\u003egetDatabaseNames();\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n#### Layout Names\n```php\n\ntry {\n  $dataApi-\u003egetLayoutNames();\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n#### Script Names\n```php\n\ntry {\n  $dataApi-\u003egetScriptNames();\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n\n#### Layout Metadata\n```php\n\ntry {\n  $dataApi-\u003egetLayoutMetadata('layout name', $recordId);\n} catch(\\Exception $e) {\n  // handle exception\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyfmbutler%2Fmyfmapilibrary-for-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyfmbutler%2Fmyfmapilibrary-for-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyfmbutler%2Fmyfmapilibrary-for-php/lists"}