PHP code example of williarin / wordpress-anonymizer
1. Go to this page and download the library: Download williarin/wordpress-anonymizer 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/ */
williarin / wordpress-anonymizer example snippets
$faker = Faker\Factory::create();
$connection = DriverManager::getConnection(['url' => 'mysql://user:pass@localhost:3306/wp_mywebsite?serverVersion=8.0']);
$tablePrefix = 'wp_';
$anonymizer = new Anonymizer([
new UserProvider($connection, $faker, $tablePrefix),
new UserMetaProvider($connection, $faker, $tablePrefix),
new CommentProvider($connection, $faker, $tablePrefix),
new WoocommerceUserMetaProvider($connection, $faker, $tablePrefix),
new WoocommercePostMetaProvider($connection, $faker, $tablePrefix),
]);
// Anonymize the whole database at once
$anonymizer->anonymize();
// or use a provider to anonymize only a part
$commentProvider = new CommentProvider($connection, $faker, $tablePrefix);
$commentProvider->anonymize();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.