2017 © Pedro PelĂĄez
 

library php-data-api-client

PHP client for DataBreakers DataAPI.

image

databreakers/php-data-api-client

PHP client for DataBreakers DataAPI.

  • Tuesday, December 12, 2017
  • by janveselynet
  • Repository
  • 1 Watchers
  • 2 Stars
  • 3,503 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 15 Versions
  • 2 % Grown

The README.md

PHP client for DataBreakers DataAPI

This library provides PHP implementation of client for DataBreakers DataAPI., (*1)

Requirements

Library requires PHP version 5.4 (or higher) and Guzzle., (*2)

Installation

The best way to install it is using the Composer:, (*3)

$ composer require databreakers/php-data-api-client

Quickstart

use DataBreakers\DataApi;

// Create a new instance of Client and provide your credentials
$client = new DataApi\Client('yourAccountId', 'yourSecretKey');

// Define items attributes (do this only when items attributes aren't defined in recommender yet)
$client->addItemsAttribute('title', DataApi\DataType::TEXT, 'en', DataApi\MetaType::TITLE);
$client->addItemsAttribute('color', DataApi\DataType::TEXT, 'en');
$client->addItemsAttribute('weight', DataApi\DataType::INTEGER);

// Add some items (if you are adding multiple items, users or interactions it's much faster to use batches)
$itemsBatch = (new DataApi\Batch\EntitiesBatch())
    ->addEntity('fridgeId', [
        'title' => 'Fridge',
        'color' => 'white',
        'weight' => 55
    ])
    ->addEntity('carId', [
        'title' => 'Car',
        'color' => 'blue',
        'weight' => 1547
    ]);
$client->insertOrUpdateItems($itemsBatch);

// Define users attributes (do this only when users attributes aren't defined in recommender yet)
$client->addUsersAttribute('name', DataApi\DataType::TEXT, 'en', DataApi\MetaType::TITLE);
$client->addUsersAttribute('age', DataApi\DataType::INTEGER);

// Add some users
$usersBatch = (new DataApi\Batch\EntitiesBatch())
    ->addEntity('johnId', [
        'name' => 'John Smith',
        'age' => 35
    ])
    ->addEntity('sophiaId', [
        'name' => 'Sophia White',
        'age' => 27
    ]);
$client->insertOrUpdateUsers($usersBatch);

// Add interactions between users and items
$interactionsBatch = (new DataApi\Batch\InteractionsBatch())
    ->addInteraction('johnId', 'carId', 'Like')
    ->addInteraction('johnId', 'carId', 'Purchase')
    ->addInteraction('johnId', 'fridgeId', 'Dislike')
    ->addInteraction('sophiaId', 'carId', 'Detail view')
    ->addInteraction('sophiaId', 'fridgeId', 'Purchase');
$client->insertInteractions($interactionsBatch);

// And finally obtain ten recommendations for Sophia and car item!
$recommendations = $client->getRecommendations('sophiaId', 'carId', 10);

// If you want to send more recommendation requests at once, you can use recommendations batch
$batchRecommendations = $client->getRecommendationsBatch((new DataApi\Batch\RecommendationsBatch())
    ->requestRecommendations('req1', 10, 'johnId', 'fridgeId', 20)
    ->requestRecommendationsForUser('req2', 5, 'sophiaId', 15)
    ->requestRecommendationsForItem('req3', 1, 'fridgeId', 10)
);

DataBreakers – we are your data sense, (*4)

The Versions

12/12 2017

dev-master

9999999-dev https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

12/12 2017

v2.1.0

2.1.0.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

19/06 2017

v2.0.0

2.0.0.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

03/04 2017

v1.2.8

1.2.8.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

15/12 2016

v1.2.7

1.2.7.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

17/08 2016

v1.2.6

1.2.6.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

08/08 2016

v1.2.5

1.2.5.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

16/07 2016

v1.2.4

1.2.4.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

14/07 2016

v1.2.3

1.2.3.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

11/07 2016

v1.2.2

1.2.2.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

15/06 2016

v1.2.1

1.2.1.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

30/03 2016

v1.2.0

1.2.0.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

05/02 2016

v1.1.0

1.1.0.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

30/11 2015

v1.0.1

1.0.1.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝

12/11 2015

v1.0.0

1.0.0.0 https://databreakers.com

PHP client for DataBreakers DataAPI.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Jan VeselĂ˝