Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate File to define requirements of the plugin #20

Closed
sumitpore opened this issue Apr 28, 2019 · 1 comment
Closed

Separate File to define requirements of the plugin #20

sumitpore opened this issue Apr 28, 2019 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@sumitpore
Copy link
Owner

Plugins can have specific requirements of

  • PHP Version
  • WP Version
  • Dependent Plugins

In a traditional way, we can add them in the main php file and then write code to check if those requirements are being met or not.

Plugin Boilerplate already supports min PHP Version & WP Version requirement feature. It does not have a dependent plugins requirement feature right now. Of course code this feature can be added in the main plugin's file but that is like adding noise in the main file. The part of checking whether requirements are being fulfilled or not should be handled by a separate class.

@sumitpore sumitpore added the enhancement New feature or request label Apr 28, 2019
@sumitpore sumitpore self-assigned this Apr 28, 2019
@sumitpore sumitpore changed the title JSON File to define requirements of the plugin Separate File to define requirements of the plugin Apr 29, 2019
@sumitpore
Copy link
Owner Author

Commits 5a860de, 658d520 & bf8a348 handle this.

The configuration for the plugin can be defined in requirements-config.php file.

Sample config could look like this

<?php
return [

	'min_php_version' => '5.6', // Minimum PHP Version.

	'min_wp_version' => '4.8',  // Minimum WordPress Version.

	'is_multisite_compatible' => false, // True if our plugin is Multisite Compatible.

	'required_plugins' => [ // Plugins on which our plugin is dependent on.

		'Hello Dolly' => [
			'plugin_slug' => 'hello-dolly/hello.php',
			'min_plugin_version' => '1.5',
		],

	],

];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant