From 237b873d6e9279b7935adcac0efd3861218182cd Mon Sep 17 00:00:00 2001 From: Siddharth Thevaril Date: Thu, 28 Sep 2023 11:43:32 +0530 Subject: [PATCH] add short and long description --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1b9b72f..b5637f3 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ # WordPress Compatibility Tool -> Short description here. +> Perform PHP and WP minimum version compatibility checks in your plugin. [![Support Level](https://img.shields.io/badge/support-beta-blueviolet.svg)](#support-level) [![MIT License](https://img.shields.io/github/license/10up/wp-compat-validation-tool.svg)](https://github.com/10up/wp-compat-validation-tool/blob/trunk/LICENSE.md) ## Overview -Long description here. +This library provides API methods to perform version validation checks in WordPress plugins. +Most helpful in situation where the plugin should gracefully exit on activation when system requirements aren't met. -## Usage +## Setup In your project's `composer.json`, add the following: @@ -39,6 +40,24 @@ In your project's `composer.json`, add the following: Replace `` with a unique namespace specific to your project. The `WP_Compat_Validation_Tools` will be replaced by `` to avoid namespace collisions in case multiple plugins use this package as their dependency. +## Usage + +```php +if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { + require_once __DIR__ . '/vendor/autoload.php'; + + $compat_checker = new \New_Name_Space\Validator(); + $compat_checker + ->set_plugin_name( '' ) + ->set_php_min_required_version( '7.4' ); + if ( ! $compat_checker->is_plugin_compatible() ) { + return; + } +} +``` + +The `Validator` class should be instantiated immediately after loading the `vendor/autoload.php` class, and the validation checks should be done before loading or instantiating any other composer dependency. + ## Support Level **Beta:** This project is quite new and we're not sure what our ongoing support level for this will be. Bug reports, feature requests, questions, and pull requests are welcome. If you like this project please let us know, but be cautious using this in a Production environment!