1. Go to this page and download the library: Download jcore/runner 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/ */
namespace my_namespace;
use Jcore\Runner\Arguments;
function update_products_callback(Arguments $args) {
// Access user input
$batch_size = $args->input['batch_size'] ?? 10;
// Access persistent data between pages
$current_page = $args->page; // Starts at 1
echo "Processing batch $current_page...\n";
// Perform your logic here...
// To continue to the next page (pagination):
if ($current_page < 5) {
$args->set_next_page();
// Pass data to the next iteration
$args->data['processed_count'] = ($args->data['processed_count'] ?? 0) + $batch_size;
}
return $args;
}
// 1. Register the status field
add_filter('jcore_runner_status', function($status) {
$status['progress_bar'] = 'Current Progress';
return $status;
});
// 2. Update it in your callback
function my_paginated_script(Arguments $args) {
$total = 100;
$current = $args->page * 10;
// This will update the 'Current Progress' section in the UI
$args->return['progress_bar'] = "$current / $total items processed";
if ($current < $total) {
$args->set_next_page();
}
return $args;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.