From 97646536c1fd7c5793d1d14a43c76569951e8acb 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 | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1b9b72f..191a495 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: @@ -37,7 +38,25 @@ 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. +The `WP_Compat_Validation_Tools` namespace will be replaced by `` to avoid namespace collisions in situations where multiple plugins use this package as their dependencies. + +## 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