PHP code example of juvo / as-processor

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

    

juvo / as-processor example snippets


use juvo\AS_Processor\AS_Processor;


// Track progress for each completed action
add_action( 'my_custom_sync/complete', function( $action, $action_id ) {
    error_log( "Action $action_id completed. Belongs to group {$action->get_group()}." );
}, 10, 1 );

// Final cleanup when ALL actions are finished
add_action( 'my_custom_sync/finish', function( $group_name ) {
    error_log( "All actions in group $group_name are finished!" );
} );

// Handle failures
add_action( 'my_custom_sync/fail', function( $action, $exception, $action_id ) {
    error_log( "Action $action_id failed: " . $exception->getMessage() );
}, 10, 3 );

// Handle deletions
add_action( 'my_custom_sync/delete', function( $chunk ) {
    error_log( "Action {$chunk->get_action_id()} was deleted." );
} );

public function on_finish(): void {
    // Your completion logic here
}

public function on_fail(): void {
    // Your failure handling logic here
}