2017 © Pedro Peláez
 

library sipht

A PHP client for the Sift Science REST API

image

99designs/sipht

A PHP client for the Sift Science REST API

  • Thursday, June 22, 2017
  • by harto
  • Repository
  • 43 Watchers
  • 0 Stars
  • 32,376 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 1 % Grown

The README.md

A PHP client for the Sift Science REST API., (*1)

Note: Sift Science now offer their own PHP bindings [here][2]., (*2)

Build Status, (*3)

This client supports the three basic operations exposed by the Sift API: posting events, labelling users and fetching scores., (*4)

The currently supported API version is v203., (*5)

Instantiating a client

Interactions with the API occur via Sift\Client. You instantiate a client by passing your API key to its constructor:, (*6)

$client = new Sift\Client('my-api-key');

The following errors may be thrown by any client request:, (*7)

  • Sift\Exception\BadRequestException: HTTP 40x; the request was rejected by the API, (*8)

  • Sift\Exception\ServerErrorException: HTTP 50x; the API endpoint suffered some internal problem, (*9)

  • Sift\Exception\HttpException: any other exception generated in the course of making the HTTP request (e.g. too many redirects), (*10)

Posting events

Create instances of Sift\Event, e.g.:, (*11)

$event = new Sift\Event(array(
    '$type' => Sift\Event::TYPE_TRANSACTION,
    '$user_id' => '1234',
    // ...
));

Alternatively, factory constructors are provided for each event type:, (*12)

$event = Sift\Event::transactionEvent(array(
    '$user_id' => '1234',
    // ...
));

Then post the event via Sift\Client::postEvent():, (*13)

$response = $client->postEvent($event);

See https://siftscience.com/docs/references/events-api for more information on posting event data., (*14)

Labelling users

Create label objects using the factory methods of Sift\Label, e.g.:, (*15)

// Label a user as fraudulent, optionally specifying reason codes and an explanation:
$reasons = array(Sift\Label::REASON_SPAM);
$label = Sift\Label::bad($reasons, 'User engaged in phishing attack')

// Alternatively, correct a false positive by labelling a user as non-fraudulent:
$good = Sift\Label::good('Mistakenly identified as fraudulent');

Then post the event via Sift\Client::labelUser():, (*16)

$response = $client->labelUser('some-user-id', $label);

See https://siftscience.com/docs/references/labels-api for more information on labelling users., (*17)

Fetching scores

Fetch fraud score data for a user via Sift\Client::userScore():, (*18)

$score = $client->userScore('some-user-id');

This returns an instance of Sift\Score. Note that if no events have been captured for the given user, a Sift\Exception\ScoreException will be thrown., (*19)

See https://siftscience.com/docs/getting-scores for more information on fetching user fraud scores., (*20)

The Versions

22/06 2017

dev-master

9999999-dev

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

22/06 2017

1.0.0

1.0.0.0

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

01/05 2017

dev-upgrade-guzzle

dev-upgrade-guzzle

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

29/07 2015

0.2.3

0.2.3.0

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

13/08 2014

0.2.2

0.2.2.0

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

13/08 2014

dev-add-new-payment-gateways

dev-add-new-payment-gateways

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

24/04 2014

0.2.1

0.2.1.0

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

24/04 2014

dev-guzzle-3.9

dev-guzzle-3.9

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

25/03 2014

0.2.0

0.2.0.0

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

25/03 2014

dev-features/guzzle-3.8

dev-features/guzzle-3.8

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

03/02 2014

203.x-dev

203.9999999.9999999.9999999-dev

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

03/02 2014

0.1.0

0.1.0.0

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

12/09 2013

202.x-dev

202.9999999.9999999.9999999-dev

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell

12/09 2013

0.0.1

0.0.1.0

A PHP client for the Sift Science REST API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Stuart Campbell