PHP code example of fmtc / fmtc-php

1. Go to this page and download the library: Download fmtc/fmtc-php 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/ */

    

fmtc / fmtc-php example snippets


composer 

ini_set('default_socket_timeout', 6000);

$fmtc = new Fmtc\Fmtc([
	'api_key' => 'api_key',
	'database' => 'database',
	'host' => 'host',
	'username' => 'username',
	'password' => 'password'
]);

// Note: these methods return raw json

// Deal Feed
$fmtc->dealFeed()->fetchFull();
$fmtc->dealFeed()->fetchIncremental();

// Merchant Feed
$fmtc->merchantFeed()->fetchFull();
$fmtc->merchantFeed()->fetchIncremental();

// Category Feed
$fmtc->categoryFeed()->fetchFull();

// Type Feed
$fmtc->typeFeed()->fetchFull();

// Network Feed
$fmtc->networkFeed()->fetchFull();

// migrate the database
$fmtc->database()->migrate();

// rollback the migration
$fmtc->database()->rollbackMigration();

// Note: these methods pull down the JSON, parse it, normalize it, and store it in the database.

// Deal Feed
$fmtc->dealFeed()->processFull();
$fmtc->dealFeed()->processIncremental();

// Merchant Feed
$fmtc->merchantFeed()->processFull();
$fmtc->merchantFeed()->processIncremental();

// Category Feed
$fmtc->categoryFeed()->processFull();

// Type Feed
$fmtc->typeFeed()->processFull();

// Network Feed
$fmtc->networkFeed()->processFull();

// Deals
$fmtc->deals()->get($dealId);
$fmtc->deals()->all([$limit, $offset]);
$fmtc->deals()->getByCategorySlug($categorySlug, [$limit, $offset]);
$fmtc->deals()->getByTypeSlug($typeSlug, [$limit, $offset]);
$fmtc->deals()->getByMerchant($merchantId, [$limit, $offset]);
$fmtc->deals()->getByMasterMerchant($masterMerchantId, [$limit, $offset]);
$fmtc->deals()->getBySearch($searchString, [$limit, $offset]);

// Merchants
$fmtc->merchants()->get($merchantId);
$fmtc->merchants()->all();
$fmtc->merchants()->getByMasterMerchant($masterMerchantId);
$fmtc->merchants()->getBySearch($searchString);

// Categories
$fmtc->categories()->get($categorySlug);
$fmtc->categories()->all();
$fmtc->categories()->getByParent($categoryParentSlug);
$fmtc->categories()->getBySearch($searchString);

// Types
$fmtc->types()->get($typeSlug);
$fmtc->types()->all();
$fmtc->types()->getBySearch($searchString);

// Networks
$fmtc->networks()->get($networkSlug);
$fmtc->networks()->all();
$fmtc->networks()->getBySearch($searchString);

// Custom Fmtc Url
$fmtc->api()->fetchUrl($url, [$options]);