• Stars
    star
    201
  • Rank 194,491 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight class to add to WordPress plugins/themes to automatically install plugin dependencies.

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.

Comprehensive information regarding WP Dependency Installer is available on the wiki.

See also: example plugin.

Description

You can use composer to install this package within your WordPress plugin / theme.

Please ensure you are using the latest version of this framework in your composer.json

  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.

  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().

  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!

Development

PRs are welcome against the develop branch.

More Repositories

1

git-updater

This WP plugin will update GitHub, Bitbucket, GitLab, and Gitea hosted plugins and themes
PHP
3,080
star
2

embed-pdf-viewer

Embed a PDF from the Media Library or elsewhere via oEmbed or a Gutenberg block. A WordPress plugin.
JavaScript
36
star
3

wp-debugging

Basic debugging settings and plugins for WordPress
PHP
33
star
4

git-updater-additions

Add repositories to Git Updater that lack actual Git Updater headers.
PHP
26
star
5

git-updater-translations

Translations for the GitHub Updater plugin
25
star
6

local-development

WordPress plugin to provide local development message for selected plugins/themes
PHP
22
star
7

setup-phpunit

Setup PHPUnit for use in Local Lightning
Shell
21
star
8

translations-updater

A WordPress library to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted language packs.
PHP
18
star
9

skip-updates

A WordPress plugin to skip updates from dot org hosted plugins or themes.
PHP
13
star
10

language-pack-maker

A framework to help make git sourced WordPress Language Packs.
PHP
11
star
11

plugin-dependencies-tab

Now at WordPress/wp-plugin-dependencies
PHP
10
star
12

github-updater-support

A support/troubleshooting plugin for GitHub Updater
PHP
9
star
13

mac-clean-install

A clean install for a new or wiped Mac
Shell
9
star
14

wp-dependency-installer-examples

Examples for use of wp-dependency-installer framework
PHP
9
star
15

wp-dismiss-notice

Add time dismissible admin notices to WordPress
PHP
8
star
16

github-theme-updater

Simple updater for GitHub based WordPress themes. This is now legacy. Refer to afragen/github-updater.
PHP
8
star
17

git-remote-updater

A REST API based remote updater for GitHub Updater
PHP
7
star
18

git-updater-gitea

Gitea API for Git Updater plugin
PHP
7
star
19

the-events-calendar-user-css

Automatically add /the-events-calendar/resources/events.css and /my-theme/events/events.css without duplicating.
PHP
7
star
20

git-updater-gist

Github Gist API for GitHub Updater plugin
PHP
7
star
21

core-rollback

Plugin to rollback WordPress Core.
PHP
7
star
22

group-plugin-installer

Allows you to easily add a group of plugins to a WordPress installation.
PHP
6
star
23

git-updater-gitlab

GitLab API for Git Updater plugin
PHP
6
star
24

singleton

A class to create singleton static proxies
PHP
6
star
25

edd-sl-updater

A universal updater for EDD Software Licensing add-ons
PHP
6
star
26

add-plugin-dependency-api

Composer library for adding a plugin dependency response based upon use with Git Updater/Git Updater PRO
PHP
6
star
27

wordpress-plugin-readme-parser

A scrape of the current WordPress.org Plugin Readme Parser
PHP
5
star
28

oembed-gist-files

WordPress plugin to embed Gists or individual files from Gists
PHP
5
star
29

autoloader

Generic Autoload class and classmap aliases using PSR-4 style
PHP
4
star
30

the-events-calendar-pro-alarm

WP plugin to add alarm to Events Calendar Pro plugin
PHP
4
star
31

login-logout-primary-menu-item

Add a login/logout item to the WordPress primary menu
PHP
4
star
32

git-updater-dependency-loader

An example loader for non-dot org plugin dependencies with the Plugin Dependencies feature project.
PHP
4
star
33

admin-only-jetpack

Show Jetpack menu for Admin users only
PHP
4
star
34

wp-site-tweaks

Added code and/or CSS to tweak the display of your WP site.
PHP
4
star
35

custom-multisite-signups

Framework for adding custom WP Multisite signup registration data
PHP
3
star
36

rollback-auto-update

Rollback protection from a plugin update that results in a PHP fatal or error
PHP
3
star
37

recipe-cpt

A recipe custom post type.
PHP
3
star
38

rename-image-meta-to-title

Automatically set the WordPress Media Library image slug, file, and URL to the title
PHP
3
star
39

skip-successful-autoupdate-email

Disable sending admin email for successful WordPress autoupdates
PHP
3
star
40

add-custom-header-images

WP plugin to rotate custom headers
PHP
2
star
41

git-updater-bitbucket

Bitbucket and Bitbucket Server API for Git Updater plugin
PHP
2
star
42

php-markdown-modified

Modification of PHP Markdown plugin to work alongside Markdown on Save variants
PHP
2
star
43

faster-updates

Speeds up plugin/theme updates by moving files rather than copying them.
PHP
2
star
44

freemius-license-installer

PHP
2
star
45

handbook-callout-blocks

PHP
2
star
46

requires-php

Proof of concept for `Requires PHP` header and updating in WordPress
PHP
2
star
47

rollback-fatal-plugin

Don't activate this plugin it will cause a PHP fatal
PHP
2
star
48

clear-github-updater-cache

Runs then deactivates, clears the GitHub Updater plugin transients
PHP
2
star
49

the-events-calendar-outlook-import-fix

A plugin to fix the problem of Outlook creating a new calendar when attempting to add events from The Events Calendar
PHP
2
star
50

git-updater-pro

Git Updater PRO - an add-on plugin for Git Updater that activates updating, remote install, etc.
PHP
1
star
51

simple-cpt

Lightweight framework for registering Custom Post Types and Taxonomies
PHP
1
star
52

git-updater-gitea-translations

Language Packs for Git Updater - Gitea
1
star
53

git-updater-gist-translations

Language Packs for Git Updater - Gist
1
star
54

test-reports

Provide easily accessible data for bug reporting.
PHP
1
star
55

git-updater-bitbucket-translations

Language Packs for Git Updater - Bitbucket
1
star
56

git-updater-pro-translations

Translations and Language Packs for the Git Updater PRO plugin.
1
star
57

test-plugin

Just an empty plugin to test Github updating
PHP
1
star
58

git-updater-additions-translations

Language Packs for Git Updater Additions
1
star
59

category-colors-options

Testing for The Events Calendar Category Colors hidden options
PHP
1
star
60

custom-multisite-signups-extra-sts

Extra registration settings for St Theresa School via custom-multisite-signups plugin
PHP
1
star
61

git-updater-gitlab-translations

Language Packs for Git Updater - GitLab
1
star
62

drmc-medical-staff-governance

Plugin for adding registration and user meta to DRMC Med Staff website
PHP
1
star
63

test-child

child theme for twentytwelve for testing
CSS
1
star
64

git-remote-updater-translations

Language Packs for Git Remote Updater
1
star
65

advanced-plugin-dependencies

Add-on to Plugin Dependencies feature
PHP
1
star