PHP code example of wahyulingu / piuu

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

    

wahyulingu / piuu example snippets



WahyuLingu\Piuu\ActionExecutor;
use WahyuLingu\Piuu\DelayHelper;
use WahyuLingu\Piuu\TypoGenerator;
use WahyuLingu\Piuu\TypingSimulator;
use WahyuLingu\Piuu\ClickSimulator;
use WahyuLingu\Piuu\HumanizedActions;

$executor = new ActionExecutor();
$delayHelper = new DelayHelper($executor);
$typoGenerator = new TypoGenerator();
$typingSimulator = new TypingSimulator($executor, $delayHelper, $typoGenerator);
$clickSimulator = new ClickSimulator($executor, $delayHelper);

$humanizedActions = new HumanizedActions($typingSimulator, $clickSimulator);


$sendKeyAction = function(string $key) {
    echo "Send key: {$key}\n";
};

$callback = function(string $phase, string $actionName, $data) {
    echo "[{$phase}] {$actionName}: " . json_encode($data) . "\n";
};

$text = "Hello, world! This is PIUU.";
$humanizedActions->sendKeysHumanized($text, $sendKeyAction, $callback);


$clickAction = function() {
    echo "Click executed\n";
};

$humanizedActions->clickHumanized($clickAction, $callback);


$humanizedActions->delay(100000, 300000, $callback);

piuu/
├── composer.json
├── README.md
└── src/
    ├── ActionExecutor.php
    ├── DelayHelper.php
    ├── TypoGenerator.php
    ├── TypingSimulator.php
    ├── ClickSimulator.php
    └── HumanizedActions.php