Skip to content
Grav 2.0 is officially stable. Read the announcement →
Plugins

Best practice for plugin dependencies

Solved by Ole Vik View solution

Started by Richard Hainsworth 8 years ago · 3 replies · 961 views
8 years ago

I've written several plugins for shortcodes. All of them obviously depend on shortcode-core.

However, when testing code I try to install the minimum number of plugins, and I forget to install shortcode-code.

What is the best practice for ensuring that a plugin which depends on another plugin installs the dependency first?

I have searched using 'grav dependencies' and come across references to the file .dependencies but there does not seem to be any easily available description about what .dependencies should contain.

In addition, there is a post saying that .dependencies is a hold-over from a previous development system, and that indicates it is not the best way forward.

8 years ago Solution

In my opinion, always use the dependencies in the plugin's blueprints, and use them exhaustively.

This will ensure that GPM installs the dependencies only if they resolve with the current Grav-environment.

8 years ago

I looked up google-maps, a plugin I've used that I know depends shortcode core, and saw that it uses the plugin blueprint as per Ole's comment.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Vladimir Novak, 2 weeks ago
3 291 2 weeks ago
Plugins · by Mathieu Lecouturier, 3 weeks ago
3 277 3 weeks ago
Plugins · by Slebeig, 2 months ago
1 403 2 months ago
Plugins · by Rene, 2 months ago
2 574 2 months ago
Plugins · by Xavier, 3 months ago
2 490 3 months ago