PHPackages                             summer-wqm/sift-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. summer-wqm/sift-php

ActiveLibrary

summer-wqm/sift-php
===================

Sift Science PHP library

02.7kPHP

Since Nov 5Pushed 7y agoCompare

[ Source](https://github.com/SummerWQM/sift-php)[ Packagist](https://packagist.org/packages/summer-wqm/sift-php)[ RSS](/packages/summer-wqm-sift-php/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Sift Science PHP Bindings [![](https://camo.githubusercontent.com/2b4d05cc2de48db32b673bb645b63479bc71bdf8d1bb296f66a05773a5a74872/68747470733a2f2f7472617669732d63692e6f72672f53696674536369656e63652f736966742d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/SiftScience/sift-php)
=========================================================================================================================================================================================================================================================================================================

[](#sift-science-php-bindings-)

Installation
------------

[](#installation)

### With Composer

[](#with-composer)

1. Add siftscience/sift-php as a dependency in composer.json.

    ```
    "require": {
        ...
        "siftscience/sift-php" : "2.*"
        ...
    }

    ```
2. Run `composer update`.
3. Now `SiftClient` will be autoloaded into your project.

    ```
    require 'vendor/autoload.php';

    $sift = new SiftClient(array(
        'api_key' => 'my_api_key',
        'account_id' => 'my_account_id'
    ));

    // or

    Sift::setApiKey('my_api_key');
    Sift::setAccountId('my_account_id');
    $sift = new SiftClient();

    ```

### Manually

[](#manually)

1. Download the latest release.
2. Extract into a folder in your project root named "sift-php".
3. Include `SiftClient` in your project like this:

    ```
    require 'sift-php/lib/Services_JSON-1.0.3/JSON.php';
    require 'sift-php/lib/SiftRequest.php';
    require 'sift-php/lib/SiftResponse.php';
    require 'sift-php/lib/SiftClient.php';
    require 'sift-php/lib/Sift.php';

    $sift = new SiftClient(array(
        'api_key' => 'my_api_key',
        'account_id' => 'my_account_id'
    ));

    ```

Usage
-----

[](#usage)

### Track an event

[](#track-an-event)

Here's an example that sends a `$transaction` event to sift.

```
$sift = new SiftClient(array('api_key' => 'my_api_key'));
$response = $sift->track('$transaction', array(
    '$user_id' => '23056',
    '$user_email' => 'buyer@gmail.com',
    '$seller_user_id' => '2371',
    '$seller_user_email' => 'seller@gmail.com',
    '$transaction_id' => '573050',
    '$currency_code' => 'USD',
    '$amount' => 15230000,
    '$time' => 1327604222,
    'trip_time' => 930,
    'distance_traveled' => 5.26,
));

```

### Label a user as good/bad

[](#label-a-user-as-goodbad)

```
$sift = new SiftClient(array('api_key' => 'my_api_key'));
$response = $sift->label('23056', array(
    '$is_bad' => true,
    '$abuse_type' => 'promotion_abuse'
));

```

### Unlabel a user

[](#unlabel-a-user)

```
$sift = new SiftClient(array('api_key' => 'my_api_key'));
$response = $sift->unlabel('23056', array('abuse_type' => 'content_abuse'));

```

### Get a user's score

[](#get-a-users-score)

```
$sift = new SiftClient(array('api_key' => 'my_api_key'));
$response = $sift->score('23056');
$response->body['scores']['payment_abuse']['score']; // => 0.030301357270181357

```

### Get the status of a workflow run

[](#get-the-status-of-a-workflow-run)

```
$sift = new SiftClient(array('api_key' => 'my_api_key', 'account_id' => 'my_account_id'));
$response = $sift->getWorkflowStatus('my_run_id');
$response->body['state']; // => "running"

```

### Get the latest decisions for a user

[](#get-the-latest-decisions-for-a-user)

```
$sift = new SiftClient(array('api_key' => 'my_api_key', 'account_id' => 'my_account_id'));
$response = $sift->getUserDecisions('example_user');
$response->body['decisions']['account_abuse']['decision']['id']; // => "ban_user"

```

### Get the latest decisions for an order

[](#get-the-latest-decisions-for-an-order)

```
$sift = new SiftClient(array('api_key' => 'my_api_key', 'account_id' => 'my_account_id'));
$response = $sift->getOrderDecisions('example_order');
$response->body['decisions']['payment_abuse']['decision']['id']; // => "ship_order"

```

Contributing
------------

[](#contributing)

Run the tests from the project root with [PHPUnit](http://phpunit.de) like this:

```
phpunit --bootstrap vendor/autoload.php test

```

Updating Packagist
------------------

[](#updating-packagist)

1. Update `composer.json` to reflect the new version, as well as any new requirements then merge changes into master.
2. Create a [new release](https://github.com/SiftScience/sift-php/releases)with the version number and use it as the description. [Packagist](https://packagist.org/packages/siftscience/sift-php) will automatically deploy a new package via the configured webhook.

License
-------

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/60804a5fdfef5eb678da92930210028b7558afe7bc82b17ef9c0c001a57b5e01?d=identicon)[SummerWQM](/maintainers/SummerWQM)

### Embed Badge

![Health badge](/badges/summer-wqm-sift-php/health.svg)

```
[![Health](https://phpackages.com/badges/summer-wqm-sift-php/health.svg)](https://phpackages.com/packages/summer-wqm-sift-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
