PHP code example of lablnet / stepwright-php

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

    

lablnet / stepwright-php example snippets




ablnet\StepWright\StepWright;
use Lablnet\StepWright\DTOs\TabTemplate;
use Lablnet\StepWright\DTOs\BaseStep;

$flow = new TabTemplate(
    tab: 'search',
    steps: [
        new BaseStep(id: 'nav', action: 'navigate', value: 'https://news.ycombinator.com'),
        new BaseStep(
            id: 'extract',
            action: 'foreach',
            object: '.athing',
            subSteps: [
                new BaseStep(id: 'title', action: 'data', object: '.titleline', key: 'title')
            ]
        )
    ]
);

$results = StepWright::runScraper([$flow]);
print_r($results);
bash
composer