Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions .github/logo-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 95 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
# PHP client library for consuming the FileMaker Data API
<p align="center">
<a href="https://github.com/flooris/filemaker-data-api#gh-light-mode-only" target="_blank">
<img src="./.github/logo-light.svg" alt="Filemaker Data API logo" width="300">
</a>
<a href="https://github.com/flooris/filemaker-data-api#gh-dark-mode-only" target="_blank">
<img src="./.github/logo-dark.svg" alt="Filemaker Data API logo" width="300">
</a>
</p>

<p align="center">
Easy to use wrapper for the read and write filemaker api connection made to work. <br>Available as <a href="#basic-usage">basic PHP</a> usage and via first-party <a href="#laravel">Laravel</a> framework.
<p>

<p align="center">
<a href="https://packagist.org/packages/flooris/filemaker-data-api">
<img src="https://img.shields.io/packagist/dt/flooris/filemaker-data-api.svg" alt="Total Downloads">
</a>
<a href="https://github.com/flooris/filemaker-data-api/releases">
<img src="https://img.shields.io/packagist/v/flooris/filemaker-data-api.svg" alt="Latest Release">
</a>
<a href="https://github.com/flooris/filemaker-data-api/blob/master/LICENSE">
<img src="https://img.shields.io/packagist/l/flooris/filemaker-data-api.svg" alt="License">
</a>
</p>

PHP package (client library) for consuming the FileMaker Data API, with Laravel support.

## Install
## Basic Usage

Via Composer:
First, install flooris/filemaker-data-api from Composer:

```bash
composer require flooris/filemaker-data-api
```


## Basic Usage
Then the basic use of finding a record and their output. More information can be found in the <a href="https://github.com/flooris/filemaker-data-api/wiki">Wiki</a>

```php
// Include Composer's autoloader.
require_once __DIR__ . '/vendor/autoload.php';

// Define the pagination variables
$offset = 1;
$limit = 100;
$limit = 100;

// Define the FileMaker Lay-out
$layoutName = 'Products';
Expand Down Expand Up @@ -51,6 +71,73 @@ foreach ($result->data as $fmResultObject) {
}
```

## Laravel
First, install flooris/filemaker-data-api from composer:
```bash
composer require flooris/filemaker-data-api
```
<br />

You can use the basic configuration file the config file by running the following command.
```bash
php artisan vendor:publish --tag="filemaker-data-api"
```

This will get the published config file with the following contents:
```php
return [
'default' => [
'hostname' => env('FM_HOSTNAME'),
'port' => env('FM_PORT', null),
'protocol' => env('FM_PROTOCOL', 'https://'),
'version' => env('FM_VERSION', 'v1'), // v1 or vLatest
'database' => env('FM_DATABASE', 'default'),

'username' => env('FM_USERNAME'),
'password' => env('FM_PASSWORD'),
],
'settings' => [
'boolean_true_values' => ['true', '1', 'yes', 'y', 'j', 'ja'],
'date_format' => env('FM_DATE_FORMAT', 'm-d-Y'),
'session_ttl' => env('FM_SESSION_TTL', 400),
],
];
```

Then you can setup the env variables.
```dotenv
FM_HOSTNAME=
FM_PORT=80
FM_DATABASE=
FM_USERNAME=
FM_PASSWORD=
```

Now you can setup a tinker script to test the connection and use it as basic as possible
```php
// Define the pagination variables
$offset = 1;
$limit = 100;

// Define the FileMaker Lay-out
$layoutName = 'Products';

// Set up the FileMaker find query
$findQuery = [
'some_field_name' => 'text to find',
];

// Set up the client.
$client = new \Flooris\FileMakerDataApi\Client();

$result = $client
->record($layoutName)
->findRecords($findQuery, $offset, $limit)
```




## Advanced usage

Define a Model Class for a FileMaker record, for example: `FmBrandObject`.
Expand Down