Need a PHP Wrapper to Connect to the FileMaker Data API?
by Duane Weller, eXcelisys FileMaker/Web Developer
I’ve built a number of FileMaker Custom Web Publishing (CWP) websites using the FileMaker Data API. With this eXperience I have learned that writing the PHP code to connect to the FileMaker Data API can be tedious and time-consuming. In order to eXpedite development, you need a library of simple, pre-built functions that give you easy access to the features of the FileMaker Data API. Fortunately, Claris publishes such a list and it includes not only PHP libraries, but libraries for many other programming languages. Check it out: Data API/Admin API Packages/Wrappers For FM 17+
I reviewed the four PHP libraries included in the list — FMDataAPI, fmPDA, fmREST and fmRESTor — but I wasn’t sold on any particular one. They are all fine libraries, perfectly acceptable for including in many PHP projects; however, I found them all a little awkward to integrate and some of them just wouldn’t work as a library for larger projects. What I discovered is that they are not structured well for use in PHP frameworks where webpage logic and database queries are often coded independently.
In the end, I got tired of playing around and wondered, Can I build a better mousetrap?
I got to work and developed my own open source PHP library: introducing the FMXData PHP Library for the FileMaker Data API. It is specifically designed for use in PHP frameworks but will work well in most PHP applications. It features a single file design that’s easy to include in a framework or any other PHP project. It includes a PDF manual covering all of the supported functions. It supports connecting to and disconnecting from the FileMaker Data API. You can get FileMaker Server information; list available databases; list scripts and layouts; add, edit and delete FileMaker records; perform finds and sort the results; run scripts; set global fields and even upload container field files.
- Singe File Design
- PDF Manual Included
- Separate Functions for Connecting and Disconnecting
- Get FileMaker Server Info
- List Available Databases
- List Layouts & Scripts
- Add, Edit and Delete FileMaker Records
- Perform Finds and Sort the Results
- Run Scripts
- Set Global Fields
- Upload Container Field Files
Guess what? The source code, eXample files and documentation for FMXData are available as a free download from GitHub: FMXData: A PHP Library for the FileMaker Data API
Download it and try it out. I’ve posted it on Github as a beta release. Everyone is welcome to review it. You can post any bug reports or feature requests right on Github. So far, it has worked well for me but I’d love for it to be put through the paces to ensure it’s a comprehensive solution for every developer in every situation!
To read more FileMaker/web tips from our developers, check out eX-Cetera, our blog where we offer FileMaker Tips and Tricks and other general Web Tips and Tricks.
**This article is provided for free and as-is; use, enjoy, learn, and experiment at your own risk – but have fun! eXcelisys does not offer free support or free assistance with any of the contents of this blog post. If you would like help or assistance, please consider retaining eXcelisys’ database and website support/maintenance services.
Leave A Comment