PHP code example of dawood / phpscreenrecorder

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

    

dawood / phpscreenrecorder example snippets




use dawood\PhpScreenRecorder\ScreenRecorder;

$screenRecorder=new ScreenRecorder();
$screenRecorder->setScreenSizeToCapture(1920,1080);

$screenRecorder->startRecording(__DIR__.DIRECTORY_SEPARATOR.'myVideo');
sleep(5+2);//doing random stuff
//when done stop recording
$screenRecorder->stopRecording();

print "video is saved at :\"".$screenRecorder->getVideo().'"'.PHP_EOL;



public function testLoginUserCorrectly()
{
    $this->screenRecorder->setScreenSizeToCapture(1920,1080);
    $this->screenRecorder->startRecording(__DIR__."/videos/loginCorrectly.flv",2);
    $loginInput = [
        'username' => 'test',
        'password' => 'password'
    ];
    $this->visit('/')
        ->submitForm("#loginform > form",$loginInput)
        ->wait(3)
        ->see("Logout")
        ->wait(2);
    $this->screenRecorder->stopRecording(0);

}

                 
       $options['-show_region'=>'1']
       $screenRecorder->setOptions($options);