Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bernskioldmedia/wp-dependency-checker
A modern way of checking for other plugin dependencies for your WordPress plugin.
https://github.com/bernskioldmedia/wp-dependency-checker
dependency-manager trait wordpress wordpress-helpers
Last synced: 7 days ago
JSON representation
A modern way of checking for other plugin dependencies for your WordPress plugin.
- Host: GitHub
- URL: https://github.com/bernskioldmedia/wp-dependency-checker
- Owner: bernskioldmedia
- License: mit
- Created: 2020-04-24T09:02:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-30T14:27:34.000Z (over 3 years ago)
- Last Synced: 2024-10-01T02:58:21.169Z (3 months ago)
- Topics: dependency-manager, trait, wordpress, wordpress-helpers
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# WP Dependency Checker
This is a simple library for a WordPress plugin that check for plugin dependencies.Often when we do private projects we may require one or more plugins to be active. It just
isn't sensible for us to make everything work without. This saves time and money for us and our clients.aWhen we do, we find ourselves in need of checking dependencies. This library helps you add it to your plugin in a
modern PHP fashion using traits.If dependencies are not found you can handle them and an admin notice is shown.
## Getting started
All you need to do is include the `Has_Dependencies` trait in the plugin class where you want to
check your dependencies. Ideally before you execute any code.Then specificy a list of plugin dependencies in the `$dependencies` class variable.
```
use BernskioldMedia\WP\WP_Dependency_Checker\Traits\Has_Dependencies;class My_Plugin {
use Has_Dependencies;
protected static $dependencies = [
'My Dependency' => 'folder/main-file.php',
];}
```When you need to check for your dependencies, you then run an if:
```
if(self::has_dependencies()) {
// Run my code
}
```The `has_dependencies` function will automatically show an admin notice if falsy.