diff --git a/.github/logo-dark.svg b/.github/logo-dark.svg new file mode 100644 index 0000000..517ad23 --- /dev/null +++ b/.github/logo-dark.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/.github/logo-light.svg b/.github/logo-light.svg new file mode 100644 index 0000000..52794d7 --- /dev/null +++ b/.github/logo-light.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 06f59a1..1fa209d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,37 @@ -# PHP client library for consuming the FileMaker Data API +

+ + Filemaker Data API logo + + + Filemaker Data API logo + +

+ +

+ Easy to use wrapper for the read and write filemaker api connection made to work.
Available as basic PHP usage and via first-party Laravel framework. +

+ +

+ + Total Downloads + + + Latest Release + + + License + +

-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 Wiki ```php // Include Composer's autoloader. @@ -19,7 +39,7 @@ require_once __DIR__ . '/vendor/autoload.php'; // Define the pagination variables $offset = 1; -$limit = 100; +$limit = 100; // Define the FileMaker Lay-out $layoutName = 'Products'; @@ -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 +``` +
+ +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`.