2017 © Pedro Peláez
 

library wp-dependency-installer

Library that helps WordPress plugin dependency management.

image

afragen/wp-dependency-installer

Library that helps WordPress plugin dependency management.

  • Saturday, July 21, 2018
  • by afragen
  • Repository
  • 8 Watchers
  • 63 Stars
  • 214 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 11 Versions
  • 39 % Grown

The README.md

WP Dependency Installer

This is a drop in class for developers to optionally or automatically install plugin dependencies for their own plugins or themes. It can install a plugin from wp.org, GitHub, Bitbucket, GitLab, Gitea, or a direct URL., (*1)

Comprehensive information regarding WP Dependency Installer is available on the wiki., (*2)

See also: example plugin., (*3)

Description

You can use composer to install this package within your WordPress plugin / theme., (*4)

Please ensure you are using the latest version of this framework in your composer.json, (*5)

  1. Within your plugin or theme root folder, run the following command:
composer require afragen/wp-dependency-installer
  1. Then create a sample wp-dependencies.json file
[
  {
    "name": "Git Updater",
    "host": "github",
    "slug": "git-updater/git-updater.php",
    "uri": "afragen/git-updater",
    "branch": "develop",
    "required": true,
    "token": null
  },
  {
    "name": "Query Monitor",
    "host": "wordpress",
    "slug": "query-monitor/query-monitor.php",
    "uri": "https://wordpress.org/plugins/query-monitor/",
    "optional": true
  },
  {
    "name": "Local Development",
    "host": "wordpress",
    "slug": "local-development/local-development.php",
    "uri": "https://wordpress.org/plugins/local-development/",
    "required": true
  }
]

You will then need to update wp-dependencies.json to suit your requirements., (*6)

  1. Finally add the following lines to your plugin or theme's functions.php file:
require_once __DIR__ . '/vendor/autoload.php';
add_action( 'plugins_loaded', static function() {
  WP_Dependency_Installer::instance( __DIR__ )->run();
});

WP_Dependency_Installer should be loaded via an action hook like plugins_loaded or init to function properly as it requires wp-includes/pluggable.php to be loaded for wp_create_nonce()., (*7)

  1. (optional) Take a look at some of built in Hooks and Functions to further customize your plugin look and behaviour:

That's it, happy blogging!, (*8)

Development

PRs are welcome against the develop branch., (*9)

The Versions

21/07 2018

dev-master

9999999-dev

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

21/07 2018

1.4.0

1.4.0.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

21/07 2018

dev-develop

dev-develop

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

19/06 2018

1.3.3

1.3.3.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

19/08 2017

1.3.2

1.3.2.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

24/05 2017

1.3.1

1.3.1.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

04/05 2017

1.3.0

1.3.0.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

03/05 2017

1.2.0

1.2.0.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

13/11 2016

1.1.0

1.1.0.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

13/11 2016

1.0.1

1.0.1.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires

 

12/11 2016

1.0

1.0.0.0

Library that helps WordPress plugin dependency management.

  Sources   Download

MIT

The Requires