blakewilson / wp-enforce-semver
A class to enforce SemVer in your WordPress plugins.
Installs: 8 995
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 2
Forks: 0
Open Issues: 1
Language:TypeScript
Requires
- phlak/semver: ^4.1
Requires (Dev)
README
Easily enforce SemVer in your WordPress plugins.
By using this class, auto updates will be disabled when the plugin's new version is a major
update, and provide a helpful notice in the update section of the plugin that there may be breaking changes.
Usage
- Install the class as a dependency via composer:
composer require blakewilson/wp-enforce-semver
- Initialize the class in your plugin:
// Init autoloader from Composer if ( file_exists( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' ) ) { require plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; } use EnforceSemVer\EnforceSemVer; new EnforceSemVer('my-plugin/my-plugin.php');
And that's it! Once your end-users install your plugin, they will be protected against auto updates for major releases, and see a helpful message in the plugins list next to your plugin update:
Additionally, this notice text can be modified via a filter:
add_filter( 'semantic_versioning_notice_text', function($notice_text, $plugin_file_name) { // Modify notice text here. return $notice_text; });