WordPress Plugin Boilerplate Powered 2.0.0

- Development, Open Source, PHP, Wordpress

WPBP is dead! Long live to WPBP!

The last 1.x release is 1.2.0 and that branch changed my thinking way of development in WordPress and also of others.

I learned to develop my plugins focusing on the idea and not on the other things that a plugin need.

For that reason I created a new version that is Composer powered but also with many improvements!

WPBP on GitHub

First of all WPBP organization on GitHub.

I do it that decision because there is people that use it and also to promote the development of the boilerplate between other developers.

Also because with the switch on composer I moved many internal libraries in the boilerplate as composer packages that are now in the organization.

New logo

WPBPThanks to Eugenio Petullà now we have a new logo that explain better what mean for me the boilerplate. Something where you can alter as you want the core of the system easily.

This is what I asked for the new logo and I think that the atoms explain very well that is for WordPress.

New motto

WordPress Plugin Boilerplate Powered is a complete foundation for building your WordPress plugins.
The mainly purpose of this boilerplate: choose a library or a snippet and the boilerplate contain already the example for use it without need a manual copy&paste way or look on internet.

Bye bye Submodule

I removed it because we are moved to composer and we don’t need it anymore (also to simplify the generator).

Code Generator

The old yeoman generator is a mess. Is complicated to maintain and optimize at every release and require many testing.

So I choose a new way to a pure PHP code generator, easy to install, lightweight that works very well.

First of all you don’t have anymore a question system but the generator create a json file that you can configure removing (lines) modules etc.

Next the generator parse that and download the boilerplate and do the magic (remove the stuff that you don’t need).

The new generator weight is 5mb and the oldest is 25mb. Also is very fast and use a template system based on Handlebars to do the magic.

You can install as binary or with composer globally and is the unique things that you need to download the boilerplate.

At the same time have new features based on the new boilerplate.

So forget the old yeoman package that is obsolete and not maintained anymore.

Composer

The boilerplate is composer based with few specific support for organize better the modules based on admin, public or generic position in the plugin itself.

This not change the composer workflow because use a composer module with my (WPBP) fork for composer/installers that add completely this feature.

Why move the modules from vendor/ to admin/lib, includes/lib, public/lib also exist the composer autoloader?

To improve your memory about the purpose of the modules. This is my decision but is a boilerplate and from the composer.json you can change that behaviour.

Updates on old modules

The libraries integrated now are composer modules and for few of them I added new features:

Also that modules support PHP 5.2 as explained in the readmes.

New Snippets integrated

  • Support for the Web Push plugin, to integrate custom push notifications to the users
  • Transient example with an external request

New Modules

The 2.0.0 contain new modules like WP Dismissible Notices Handler, WP Review Me, Posts to Posts and Custom Fields Permalink.

Code changes

  • Moved some codes as specific files with a class
  • File rename internally with a better organization
  • Uninstall moved as filter to support Freemius
  • Assets moved outside the plugin folder
  • Removed .compatinfo.php because with composer is required php 5.2
  • bin folder with the bash scripts
    • The script to change the version was improved by Mattia Migliorini and next get the support for the 2.0.0
  • Moved slug, plugin name and version as constants
    • This was one of the key point that enable to simplify so much the code and avoid call to a class

Wiki depowered

The new wiki is very lightweight so you can use the readme of every module used and the code generated as documentation.

In this way less wiki to maintain and simple to get information inside your code.

And now?

All the other features like grunt or Coffescript and Sass, they remain so check the official readme for all the features.

Workflow

Very easy, install the generator and execute. Next edit the json file generated based on your needs and execute again to download everything.

My thoughts

This was a long work to improve all the pieces and in the meantime I already started to use with improvements on time and speed up to create a new plugin.

Future

Continue to improve it with new snippets and also other modules integrated.

It’s your time to coding!

Liked it? Take a second to support Mte90 on Patreon!

Become a Patreon
All the stuff released in this website, where the author is Daniele Scasciafratte, is under the GPL 2.0 license except when the resources have their licenses.

Leave a Reply