Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Best practice for plugin dependencies

Solved by Ole Vik View solution

Started by Richard Hainsworth 8 years ago · 3 replies · 1195 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 DrPen, 1 month ago
2 478 1 month ago
Plugins · by renedebaaij, 2 months ago
1 350 1 month ago
Plugins · by Thomas, 1 month ago
1 375 1 month ago
Plugins · by complanar, 2 months ago
6 699 2 months ago
Plugins · by BenLaKnet, 2 months ago
1 642 2 months ago