PHP code example of tiagof2 / integration-callback-feedback

1. Go to this page and download the library: Download tiagof2/integration-callback-feedback 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/ */

    

tiagof2 / integration-callback-feedback example snippets


use Tiagof2\IntegrationCallback\Feedback;

$request_url = 'http://fake-url.com/notify_status';

$callback_data = new Feedback($callback_data_values = [
    'protocol'          => 'my-protocol-id', //'essage   = 'The account has been created successfuly';

if($callback_data->isValid())
{
    $callback_data->makeRequest($success, $optional_message);
}

use Tiagof2\IntegrationCallback\Feedback;

$fake_url = 'http://fake-url.com/notify_status';
$is_fake  = true;//default false

$callback_data = new Feedback($callback_data_values = [
    'protocol'          => 'my-protocol-id', //'a test
$this->assertTrue($callback_data->isFake());

//Setting assert return value to true
$callback_data->assertValue(true);//bool

$success            = true; //bool
$optional_message   = 'The account has been created successfuly';
$this->assertTrue($callback_data->makeRequest($success, $optional_message));//returns true (will not make the realy request)

//Setting assert return value to false
$callback_data->assertValue(false);//bool
$this->assertFalse($callback_data->makeRequest($success, $optional_message));//returns false (will not make the realy request)