PHP code example of 10up / wp-gears

1. Go to this page and download the library: Download 10up/wp-gears 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/ */

    

10up / wp-gears example snippets


define( 'WP_ASYNC_TASK_SALT', 'my-unique-salt-1' );

if ( ! isset( $_SERVER['HTTP_HOST'] ) && defined( 'DOING_ASYNC' ) && DOING_ASYNC ) {
  $_SERVER['HTTP_HOST'] = DOMAIN_CURRENT_SITE;
}
 test-worker.php
 test-client.php "Hello World"

// Add a task, that will call the "myplugin_update_option" action when it is run
wp_async_task_add( 'myplugin_update_option', array( 'mykey' => 'myvalue' ) );

function myplugin_update_option_callback( $args ) {
	// In reality, you are probably doing a lot of resource intensive work here
	update_option( 'my-option-name', $args['mykey'] );
}

// Add the action that links the task and the callback.
// Notice the hook below is the same as the hook provided to wp_async_task_add.
add_action( 'myplugin_update_option', 'myplugin_update_option_callback' );

wp-settings.php
wp-minions-runner.php
wp-config.php
yum install gearmand php-pecl-gearman python-pip
yum install gearmand php-pecl-gearman --enablerepo=remi-php72
wp-config.php
wp-config.php
:php
# Gearman config
global $gearman_servers;
$gearman_servers = array(
  '127.0.0.1:4730',
);