Friday, 8 June 2018

Using Composer for Libraries in WordPress Plugins or Themes


When you’re building several WordPress plugins or themes, you might come to realisation that you’re copying the same code over and over again. This might be classes for creating settings, libraries to change the whole admin area or it can be just a library that contains the whole logic behind updating your premium plugins. In this tutorial, we will go over a Composer configuration which can help you retrieve that repetitive code and place it inside a folder of your plugin.
What is Composer?
I don’t want to spend too much on what is Composer but if you’ve never heard of it, it is a package manager for PHP libraries. This libraries can be placed on https://packagist.org/ or somewhere else, such as a GitHub repository.
Before following this tutorial, make sure that you have a Composer installed. I would recommend you to install it globally on your system so you can use it in every product.
By configuring Composer properly, you can import all the newest updates from those libraries with one command. Do note that some libraries can be used for production and some are for development-only.
Development-only libraries (or packages) are those that you don’t require
Source: https://managewp.org/articles/17509/using-composer-for-libraries-in-wordpress-plugins-or-themes



source https://williechiu40.wordpress.com/2018/06/08/using-composer-for-libraries-in-wordpress-plugins-or-themes/

No comments:

Post a Comment