PHP code example of perfitdev / sdkphp

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

    

perfitdev / sdkphp example snippets






$response = $perfit->get('/contacts', ['limit' => 20, 'sortBy' => 'email']);

$response = $perfit->get('/contacts/134');

$response = $perfit->post('/contacts', ['firstName' => 'John', 'email' => '[email protected]']);

$response = $perfit->put('/contacts/134', ['firstName' => 'Mario']);

$response = $perfit->delete('/contacts/134');

$response = $perfit->lists->params(['bounced' => true, 'action' => 'delete'])->id(3)->clean();



$perfit = new PerfitSDK\Perfit( ['apiKey' => 'myaccount-Es6R0UIh4naZIhwIsZDQUecP62PcLCP7' ] );

$response = $perfit->contacts->get();



$perfit = new PerfitSDK\Perfit( ['apiKey' => 'myaccount-Es6R0UIh4naZIhwIsZDQUecP62PcLCP7' ] );

$response = $perfit->contacts->params(['state' => 'active'])->limit(30)->sort('email')->get();



$perfit = new PerfitSDK\Perfit( ['apiKey' => 'myaccount-Es6R0UIh4naZIhwIsZDQUecP62PcLCP7' ] );

$response = $perfit->contacts->id(201)->get();



$perfit = new PerfitSDK\Perfit( ['apiKey' => 'myaccount-Es6R0UIh4naZIhwIsZDQUecP62PcLCP7' ] );


$response = $perfit->contacts->params(['firstName' => 'Mario'])->id(23)->put();



$perfit = new PerfitSDK\Perfit( ['apiKey' => 'myaccount-Es6R0UIh4naZIhwIsZDQUecP62PcLCP7' ] );

$params = ['firstName' => 'Jorge', 'lastName' => 'Lopez', 'email' => '[email protected]',];
$response = $perfit->contacts->params($params)->post();



$perfit = new PerfitSDK\Perfit( ['apiKey' => 'myaccount-Es6R0UIh4naZIhwIsZDQUecP62PcLCP7' ] );

$result = $perfit->contacts->id(43)->delete();



$perfit = new PerfitSDK\Perfit( ['apiKey' => 'myaccount-Es6R0UIh4naZIhwIsZDQUecP62PcLCP7' ] );

$result = $perfit->lists->params(['bounced' => true, 'action' => 'delete'])->id(56)->clean();

$perfit->settings(['version' => 2]);