Home / Premmerce WooCommerce Blog / Development / Premmerce Dev Tools: WordPress Debug, WordPress Plugin Boilerplate

Premmerce Dev Tools: WordPress Debug, WordPress Plugin Boilerplate

08 September 17
Reading Time: 3 minutes
No Comments
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes)

This plugin is created to facilitate the development, testing and debugging of the code on the WordPress and WooCommerce platform. Premmerce Dev Tools provide such tools as: WordPress debug, WordPress plugin boilerplate generator, WooCommerce product generator and WordPress data cleaner.

We have developed this plugin while we were testing the capabilities of WordPress for the developers. As we develop and maintain a large number of plugins and features, we will constantly improve our tools for the developers, release their new versions and will be happy to share them with you.

Meanwhile, we encourage you to take a look at our research on WordPress Development Environment and Developers Best Practices Review.

Premmerce Dev Tools: WordPress Debug, WordPress Plugin Boilerplate Generator

The main features of the plugin:

  • Integration of symgony/var-dumper for WordPress debug.
  • Integration of symfony/stopwatch for the execution time checking.
  • WooCommerce product generator – Generating the test data for WooCommerce.
  • WordPress plugin boilerplate generator, which creates the basic files structure.
  • Database clean up.

Installation

You can install this plugin from the official WordPress plugin directory or download and install it manually from our repository on GitHub.

  1. Unzip the downloaded zip file.
  2. Upload the plugin folder into the ‘wp-content/plugins/’ directory of your WordPress site.
  3. Activate ‘DevTools’ from Plugins page.

WordPress debug

Using symgony/var-dumper, you can easily debug the associative arrays and objects. For this, add the following lines to the code:

dump($var); – to output the value;
dd($var);  – to output the value and end the script work.

Here is the result in the front:

For tracking the execution time and memory usage for certain parts of the code, the symfony/stopwatch library is integrated into the plugin.

WordPress plugin boilerplate generator

The WordPress plugin boilerplate generator creates the source files and folders of the plugin based on the boilerplate we developed:

  • assets – images, css, js.
  • languages – translations.
  • src – source code.
  • views – themes.
  • BoilerplatePlugin – the main class of the plugin; the file name is generated from the plugin name.
  • FilteManager.php – the file search within the plugin.
  • Admin.php – the controller from the admin panel.
  • Frontend.php – the controller from the front.
  • composer.json – it is created when the plugin uses composer; in other cases, autoload.php is created.
  • boilerplate.php – the plugin file with the plugin description, where the plugin’s code is being initialized.
  • licence.txt – licence (GPL by default).
  • readme.txt  – readme example.

All the plugin classes are placed under its namespace, which allows you not to use the prefixes while naming classes, as they can be loaded automatically.

For the loading of the classes, the autoloader is being created in the autoload.php file. If the  “Use composer” is ticked, the composer autoloader is being used, in case the plugin includes some libraries via composer.

WooCommerce product generator

The plugin allows you to quickly generate the test data for WooCommerce.
The following settings are available on the Generate data page:

  • Products number – to set the number of the generated files;
  • Generate product photo – to generate photo for every product;
  • Product gallery photos number –  to set the number of the generated photos for the product gallery;
  • Product type – to choose the product type (Simple product, Grouped product, External/Affiliate product, Variable product);
  • Categories number – to set the number of the generated categories; the products will be evenly distributed between them;
  • Attributes number – to set the number of the product attributes, which will be generated and attached to all the products;
  • Each attribute terms number – to set the number of values for every product attribute.

Data cleaner

On the Clean up page you can quickly:

  • delete all the products, product categories, product attributes from the database;
  • delete the images that are not being used;
  • clean up the database from the elements that are not being used: posts, terms, connections, metadata.

More features coming soon.

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign up for updates

Be the first to know about Premmerce development and project news

You have successfully subscribed to our mailing list. Thank you!