afragen / wp-dependency-installer

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redundant?

afragen opened this issue · comments

@mgibbs189 is there some reason to use all this code when the following should work?

https://github.com/afragen/wp-dependency-installer/blob/develop/dependency-installer/wp-dependency-installer.php#L361-L373

WP_Dependency_Installer::instance()->register( $config );

instead of

WPDI()->register( $config );

It's mostly for convenience. Either way is fine.

I use this approach for other plugins, especially ones with lots of public methods / properties.

E.g. It's easier for other developers to type WPDI()->blah than WP_Dependency_Installer::instance()->blah whenever they need access to something in the class.

I understand, but no one will really call this as the only thing we require is the dev include the wp-dependency-installer.php file.