2017 © Pedro Peláez
 

library fmtc-php

A PHP package to interface with the FMTC Api

image

fmtc/fmtc-php

A PHP package to interface with the FMTC Api

  • Wednesday, July 6, 2016
  • by calebporzio
  • Repository
  • 5 Watchers
  • 1 Stars
  • 63 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 7 % Grown

The README.md

FMTC PHP SDK

This is the official php package to interface with FMTC's API., (*1)

Features

  • Migrate the database schema
  • Fetch FMTC's feeds (json): deals, categories, types, merchants and networks
  • Process full and incremental feeds and store in database
  • Retreive records from the database with an easy to use API

Installation, (*2)

composer require fmtc/fmtc-php

Requirements * PHP >5.4 * You may need to increase timeout so the larger API calls don't fail., (*3)

ini_set('default_socket_timeout', 6000);

Initialization, (*4)

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

Fetch JSON Feeds, (*5)

// 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();

Migrating the Database, (*6)

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

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

Processing Feeds, (*7)

// 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();

Retrieving Records These are methods to retreive records from the database. The methods return single objects or arrays of objects. The results are sorted by rating by default., (*8)

// 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]);

The Versions

06/07 2016

dev-master

9999999-dev

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

06/07 2016

dev-add-long-timeout-for-feed-calls

dev-add-long-timeout-for-feed-calls

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

15/04 2016

dev-add-begin-date-condition

dev-add-begin-date-condition

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

13/04 2016

dev-add-starred-function

dev-add-starred-function

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

31/03 2016

dev-revert-19-add-ordering-option

dev-revert-19-add-ordering-option

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

31/03 2016

dev-add-ordering-option

dev-add-ordering-option

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

25/03 2016

1.0.0

1.0.0.0

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

11/03 2016

dev-pixel-category-count-indexes

dev-pixel-category-count-indexes

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

10/03 2016

dev-pixel-category-count-update

dev-pixel-category-count-update

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

10/03 2016

dev-enable-autoupdate-of-db-timestamps

dev-enable-autoupdate-of-db-timestamps

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio

05/02 2016

dev-dont-show-expired

dev-dont-show-expired

A PHP package to interface with the FMTC Api

  Sources   Download

The Requires

 

by Caleb Porzio