1. Go to this page and download the library: Download sib-retail/fluent-fm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sib-retail / fluent-fm example snippets
use Hyyppa\FluentFM\Connection\FluentFMRepository;
$fm = new FluentFMRepository([
'file' => 'FilemakerFilename',
'host' => '127.0.0.1',
'user' => 'Admin',
'pass' => 'secret'
]);
// get a single record as array
$record = $fm->record('layout', 'id')->get();
// get multiple records as array
$records = $fm->records('layout')->limit(10)->get();
// if multiple records are matched each will be updated
$fm->update('customers', [ 'phone' => '406-555-0199' ])
->where('id',13)
->limit(1)
->exec();
// hard delete removes record
$fm->delete('customers')
->where('id',13)
->limit(1)
->exec();
// soft delete sets record's deleted_at field
$fm->softDelete('customers')
->where('id',13)
->limit(1)
->exec();
// undeletes soft deleted records
$fm->undelete('customers')
->where('id',13)
->limit(1)
->exec();
// returns matching records that have not been soft deleted
$active = $fm
->find('customers')
->where('first','Bob')
->withoutDeleted()
->get();
// returns matching records even if soft deleted (default behavior)
$all = $fm
->find('customers')
->where('first','Bob')
->withDeleted()
->get();
// if query matches multiple, file will be added to each
$fm->upload('customers', 'photo', './path/to/photo.jpg')
->where('id', 13)
->limit(1)
->exec();
// if query matches multiple, all files will be downloaded to path
$fm->download('customers', 'photo', './save/to/path/')
->where('id', 13)
->limit(1)
->exec();
...
->get()
->exec()
->create( <layout>, [fields] )
->latest( <layout>, [field] ) # table must have created_at field if [field] undefined
->oldest( <layout>, [field] ) # table must have created_at field if [field] undefined
->lastUpdate( <layout>, [field] ) # table must have updated_at field if [field] undefined
->first()
->last()
...
// set global fields on table
->globals( [table], [ key => value ] )
// enable or disable automatic setting of id field (default enabled)
->enableAutoId()
->disableAutoId()
// clear query parameters
->clearQuery()
// clear query parameters and reset to default options
->reset()