PHP code example of keboola / settle

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

    

keboola / settle example snippets



use Keboola\Settle\SettleFactory;
use Psr\Log\NullLogger;

$logger = new NullLogger();
$factory = new SettleFactory($logger);

$settle = $factory->createSettle(maxAttempts: 10, maxAttemptsDelay: 1);
$i = 0;
$settle->settle(
    comparator: fn($v) => $v === 5,
    getCurrentValue: function() use (&$i) {while ($i < 5) {$i++; return $i;}},
);