WP Manifestindependent plugin directory
manifest / developer / tinylibraries

TinyLibraries

TinyLibraries is a small attempt to solve lack of library sharing and library dependency capabilities in WordPress.

★ 7stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/ideag/tinylibraries/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

TinyLibraries is a small attempt to solve lack of library sharing and library dependency capabilities in WordPress. It allows plugin developers to define what libraries they require for their code to function in plugin headers, like this

/*
Plugin Name: TinyLibraries Sample A
Plugin URI: http://arunas.co
Description: Loads A library
Version: 0.1.0
Author: Arūnas Liuiza
Author URI: http://arunas.co
Text Domain: tinylibraries
Libraries: wp-background-processing
*/

In this example plugin declares that it requires WP Background Processing library. It will be downloaded and installed when this plugin is activated.

Later in the code, plugin developer can require_once the library via TinyLibraries()->require_library( 'wp-background-processing' ); method. You can see this in work in sample plugins: tinylibraries-sample-a.php, tinylibraries-sample-b.php and tinylibraries-sample-ab.php. They can also provide a fallback to make sure the plugin functions correctly even if TinyLibraries is not present:

if ( ! function_exists( 'TinyLibraries' ) || ! TinyLibraries()->require_library( 'wp-background-processing' ) ) {
  require_once( 'path/to/my/local/copy/of/wp-background-processing.php' );
}

Currently supported libraries: