PHP code example of wsw / sift-science

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

    

wsw / sift-science example snippets




use InvalidArgumentException;
use WSW\Email\Email;
use WSW\SiftScience\Credentials;
use WSW\SiftScience\Exceptions\SiftScienceRequestException;
use WSW\SiftScience\Services\CreateAccountService;

try {

    $credentials = new Credentials('apiToken');

    $service = new CreateAccountService($credentials);

    $account = $service->createAccountBuilder();

    $account
        ->setUserId('billy_jones_301')
        ->setSessionId('gigtleqddo84l8cm15qe4il')
        ->setUserEmail(new Email('[email protected]'))
        ->setName('Bill Jones')
        ->setPhone('1-415-555-6040');

    $service->create($account);

} catch (SiftScienceRequestException $e) {
    echo $e->getMessage();

} catch (InvalidArgumentException $e) {
    echo $e->getMessage();

}