myfmbutler/myfmapilibrary-for-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

myfmbutler/myfmapilibrary-for-php

Composer 安装命令:

composer require myfmbutler/myfmapilibrary-for-php

包简介

(Claris) FileMaker 19 API PHP wrapper

README 文档

README

Presentation

Team

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.
Sharing knowledge takes part of our DNA, that's why we developed this library to make the FileMaker Data API easy-to-use with PHP.
Break the limits of your application!
Lesterius logo

Description

This library is a PHP wrapper of the (Claris) FileMaker Data API 19.

You can find the PHP wrapper of the FileMaker Data API 17 on the releases <= v.1.* .
You can find the PHP wrapper of the FileMaker Data API 18 on the releases <= v.2.* .

You 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). General Claris document on the Data API is available here

Requirements

  • PHP >= 5.5
  • PHP cURL extension
  • PHP mb_string extension

Installation

The recommended way to install it is through Composer.

composer require myfmbutler/myfmapilibrary-for-php

After installing, you need to require Composer's autoloader:

require_once __DIR__ . '/vendor/autoload.php';

Usage

Prepare your Claris (Filmaker) solution

  1. Enable the (Claris) FileMaker Data API option on your FileMaker server admin console.
  2. Create a specific user in your (Claris) FileMaker database with the 'fmrest' privilege
  3. Define records & layouts access for this user

Use the library

Login

Login with credentials:

$dataApi = new \Lesterius\FileMakerApi\DataApi('https://test.fmconnection.com/fmi/data', 'MyDatabase', null, 'filemaker api user', 'filemaker api password');

Login with oauth:

$dataApi = new \Lesterius\FileMakerApi\DataApi('https://test.fmconnection.com/fmi/data', 'MyDatabase', null, null, true, 'oAuthRequestId', 'oAuthIdentifier');

Logout

$dataApi->logout();

Validate Session

$dataApi->validateSession();

Create record

$data = [
    'FirstName'         => 'John',
    'LastName'          => 'Doe',
    'email'             => 'johndoe@acme.inc',
    'RepeatingField(1)' => 'Test'
];

$scripts = [
    [
        'name'  => 'ValidateUser',
        'param' => 'johndoe@acme.inc',
        'type'  => Lesterius\FileMakerApi\DataApi::SCRIPT_PREREQUEST
    ],
    [
        'name'  => 'SendEmail',
        'param' => 'johndoe@acme.inc',
        'type'  => Lesterius\FileMakerApi\DataApi::SCRIPT_POSTREQUEST
    ]
];

$portalData = [
  'portalName or OccurenceName' => [
      [
          "Occurence::PortalField 1" => "Value",
          "Occurence::PortalField 2" => "Value",
      ]
  ]
];

try {
    $recordId = $dataApi->createRecord('layout name', $data, $scripts, $portalData);
} catch(\Exception $e) {
  // handle exception
}

Delete record

try {
  $dataApi->deleteRecord('layout name', $recordId, $script);
} catch(\Exception $e) {
  // handle exception
}

Edit record

try {
  $recordId = $dataApi->editRecord('layout name', $recordId, $data, $lastModificationId, $portalData, $scripts);
} catch(\Exception $e) {
  // handle exception
}

Duplicate record

try {
  $recordId = $dataApi->editRecord('layout name', $recordId, $scripts);
} catch(\Exception $e) {
  // handle exception
}

Get record

$portals = [
    [
        'name'  => 'Portal1',
        'limit' => 10
    ],
    [ 
        'name'   => 'Portal2',
        'offset' => 3
    ]
];

try {
  $record = $dataApi->getRecord('layout name', $recordId, $portals, $scripts);
} catch(\Exception $e) {
  // handle exception
}

Get records

$sort = [
    [
        'fieldName' => 'FirstName',
        'sortOrder' => 'ascend'
    ],
    [
        'fieldName' => 'City',
        'sortOrder' => 'descend'
    ]
];

try {
  $record = $dataApi->getRecords('layout name', $sort, $offset, $limit, $portals, $scripts);
} catch(\Exception $e) {
  // handle exception
}

Find records

$query = [
    [
        'fields'  => [
            ['fieldname' => 'FirstName', 'fieldvalue' => '==Test'],
            ['fieldname' => 'LastName', 'fieldvalue' => '==Test'],
        ],
        'options' => [
            'omit' => false
        ]
    ]
];

try {
  $results = $dataApi->findRecords('layout name', $query, $sort, $offset, $limit, $portals, $scripts, $responseLayout);
} catch(\Exception $e) {
  // handle exception
}

Set global fields

$data = [
  'FieldName1'	=> 'value',
  'FieldName2'	=> 'value'
];

try {
  $dataApi->setGlobalFields('layout name', $data);
} catch(\Exception $e) {
  // handle exception
}

Execute script

try {
  $dataApi->executeScript('script name', $scriptsParams);
} catch(\Exception $e) {
  // handle exception
}

Upload file to container

Renaming file

$containerFieldName       = 'Picture';
$containerFieldRepetition = 1;
// replace 'upload' below with the name="value" of the file input element of your web form
$filepath                 = $_FILES['upload']['tmp_name'];
$filename                 = $_FILES['upload']['name'];

try {
  $dataApi->uploadToContainer('layout name', $recordId, $containerFieldName, $containerFieldRepetition, $filepath, $filename);
} catch(\Exception $e) {
  // handle exception
}

Without checking filename

$containerFieldName       = 'Picture';
$containerFieldRepetition = 1;
$filepath                 = '/usr/home/acme/pictures/photo.jpg';

try {
  $dataApi->uploadToContainer('layout name', $recordId, $containerFieldName, $containerFieldRepetition, $filepath);
} catch(\Exception $e) {
  // handle exception
}

Metadata Info

Product Info

try {
  $dataApi->getProductInfo();
} catch(\Exception $e) {
  // handle exception
}

Database Names

try {
  $dataApi->getDatabaseNames();
} catch(\Exception $e) {
  // handle exception
}

Layout Names

try {
  $dataApi->getLayoutNames();
} catch(\Exception $e) {
  // handle exception
}

Script Names

try {
  $dataApi->getScriptNames();
} catch(\Exception $e) {
  // handle exception
}

Layout Metadata

try {
  $dataApi->getLayoutMetadata('layout name', $recordId);
} catch(\Exception $e) {
  // handle exception
}

myfmbutler/myfmapilibrary-for-php 适用场景与选型建议

myfmbutler/myfmapilibrary-for-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.32k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2019 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 myfmbutler/myfmapilibrary-for-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 myfmbutler/myfmapilibrary-for-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 myfmbutler/myfmapilibrary-for-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4.32k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 4
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: gpl-3.0
  • 更新时间: 2019-03-22