PHP code example of renzojohnson / wc-hpos-helper

1. Go to this page and download the library: Download renzojohnson/wc-hpos-helper 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/ */

    

renzojohnson / wc-hpos-helper example snippets


use RenzoJohnson\WcHposHelper\HposHelper;

$helper = new HposHelper(
    dsn: 'mysql:host=localhost;dbname=wordpress',
    user: 'root',
    pass: 'secret',
);

// Full audit
$report = $helper->audit();
echo $report->toJson();

// Individual audits
$orderResult = $helper->auditOrders();
$subResult = $helper->auditSubscriptions();
$customerResult = $helper->auditCustomers();
$metaResult = $helper->auditMeta();

// Check HPOS status
$helper->isHposEnabled();  // bool
$helper->isSyncEnabled();  // bool

// Standard WordPress
$helper = new HposHelper($dsn, $user, $pass, prefix: 'wp_');

// Multisite (site 2)
$helper = new HposHelper($dsn, $user, $pass, prefix: 'wp_2_');

// Custom prefix
$helper = new HposHelper($dsn, $user, $pass, prefix: 'mysite_');

$helper = new HposHelper($dsn, $user, $pass);
$helper->setSampleLimit(100); // Default is 50