wc-plugin-framework
wc-plugin-framework copied to clipboard
Move the loader WP & WC version checks to the framework
Right now our plugin loader checks for the required PHP, WordPress, and WooCommerce versions before loading the plugin itself: https://github.com/skyverge/wc-plugin-framework/blob/release-v5/woocommerce/woocommerce-framework-plugin-loader-sample.php#L119-L121
We could try and move the WP & WC version checks to the plugin base class itself to help keep the Loader class as minimal as possible. Also consider moving all of the dependency logic to its own handler class to clean things up event further.
A way to do this could be to create another loader project to be required by composer. The loader could be instantiated via variables from the plugin main file (defining things like plugin name, version requirements, some custom messages).
The drawback here is that since it couldn't be namespaced for versioning one would have to be very careful in not introducing any BC change.
Possibly the loading system could be akin to that of the Action Scheduler which IIRC doesn't rely on namespaces either and doesn't run into these issues.