PHP code example of topshelfcraft / walk

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

    

topshelfcraft / walk example snippets


$success = WalkHelper::craftyArrayWalk($elements, $callable);

$success = WalkHelper::craftyArrayWalk($elements, $callable, $userdata);

public function myMethod( $element [, $index [, $userdata ]] )

$myArray = ["Michael", "Aaron", "Andrew", "Brad", "Brandon"]

foreach ($myArray as $key => $value)
{
    $myArray[$key] = strtolower($value);
}

array_walk($myArray, 'strtolower');

$myEntries = Entry::find()->all();

foreach ($myEntries as $entry)
{
    Craft::$app->getElements->saveElement($entry);
}

WalkHelper::craftyArrayWalk($myEntries, 'elements.saveElement');

WalkHelper::spawnJobs(MyJob::class, $elementsOrIds, $settings = [], $valParam = 'elementId')

$success = WalkHelper::craftyArrayWalk($emailAddresses, 'myPlugin.myService.processEmailAddress');