Download the PHP package alessandrotesoro/wp-diagnostics without Composer

On this page you can find all versions of the php package alessandrotesoro/wp-diagnostics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-diagnostics

tests license

ℹ️ About WP Diagnostics

WP Diagnostics is a utility library to handle detection of minimum system requirements in WordPress plugins.

✨ Benefits

  1. Validate PHP Version, WordPress version, active plugins, php extensions, class existance or use custom callbacks.
  2. Support for custom requirements validators.

✅ Requirements

  1. PHP 7.2 or higher.
  2. Composer

📖 Usage

1. Installation

2. Basic usage

  1. Create an instance of Sematico\Diagnostics\Runner.
  2. Add checks using the addCheck method.
  3. Verify that requirements are satisfied using the satisfied method.
  4. Display an admin notice using the printNotice method if requirements are not met.

Example:

In the example above we're creating an instance of the Runner by passing through the plugin's entry file path, the title of the plugin an array of checks to verify.

3. Display an admin notice

When a plugin's requirements are not satisfied, you can use the printNotice method to display an error message in the admin panel and automatically disable the plugin. The notice will contain all errors found.

4. Setting up the name of the plugin

When creating an instance of the Runner, the 2nd parameter takes in a string which is used as the name of your plugin. The name is used within the error notice displayed when requirements are not satisfied.

5. Checks configuration

The third parameter of the Runner instance takes in an array containing instances of all checks required for your plugin.

In the above example, we're verifying that WordPress is at least running version 5.7 and that the php version is at least 7.2.

Alternatively you may add checks using the addCheck method.

6. Stop execution on first fail

In some cases you may want to stop the checks verification process as soon as the first error occurs. To enable this, simply set the 4th parameter as "true".

Alternatively, you may use the setBreakOnFailure method.

7. Messages customization

By default, the library does not provide support for internationalization. Should you wish to customize the default messages or add support for translation, you may use the setMessages method and overwrite any or all messages used by the library.

In the above example, we're replacing one of the strings and adding translation support too.

You can find the full list of default strings by inspecting the getDefaultMessages method of the Runner.php file.

📖 Available checks

1. Callback

Run a function and use its return value as the result.

In order to pass the check, you must return a boolean value of true. To fail a check you must return an instance of WP_Error.

2. ClassExists

Check if a class or an array of classes exists. Example:

3. ExtensionLoaded

Check if a PHP extension or an array of extensions is loaded.

4. PHPVersion

Check if the current PHP version matches the given requirement. The check accepts 2 parameters: the version to test for and the comparison operator.

5. PluginActive

Check if plugin or an array of plugins are currently active on the site.

6. WPVersion

Check if the current WordPress version matches the given requirement. The check accepts 2 parameters: the version to test for and the comparison operator.

📖 Writing custom checks

Every check class must implement the CheckInterface and extend the AbstractCheck class. You can then provide the check method which is responsible for performing the actual check.

The method must return either a true boolean value to mark the check as passed or an instance of WP_Error to mark the check as failed.

Below is an example class that checks if the registrations are allowed on the site.

🚨 Security Issues

If you discover a security vulnerability within WP Diagnostics, please email [email protected]. All security vulnerabilities will be promptly addressed.

🔖 License

Distributed under the MIT License. See LICENSE for more information.


All versions of wp-diagnostics with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alessandrotesoro/wp-diagnostics contains the following files

Loading the files please wait ....