PHP code example of kynetcode / wpzylos-requirements
1. Go to this page and download the library: Download kynetcode/wpzylos-requirements library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kynetcode / wpzylos-requirements example snippets
use WPZylos\Framework\Requirements\RequirementsServiceProvider;
// Publish config stub to your plugin
RequirementsServiceProvider::publishConfig(
__DIR__ . '/config/
use WPZylos\Framework\Requirements\RequirementsServiceProvider;
$app->register(RequirementsServiceProvider::class);
use WPZylos\Framework\Requirements\RequirementsChecker;
use WPZylos\Framework\Requirements\Requirements\PhpVersionRequirement;
use WPZylos\Framework\Requirements\Requirements\WordPressVersionRequirement;
use WPZylos\Framework\Requirements\Requirements\PhpExtensionRequirement;
use WPZylos\Framework\Requirements\Requirements\PluginRequirement;
$checker = new RequirementsChecker();
$checker
->addRequirement(new PhpVersionRequirement('8.1'))
->addRequirement(new WordPressVersionRequirement('6.0'))
->addRequirement(new PhpExtensionRequirement('json'))
->addRequirement(new PluginRequirement(
'WooCommerce',
'woocommerce/woocommerce.php',
'8.0.0'
));
if ($checker->hasFailures()) {
foreach ($checker->getErrors() as $error) {
error_log($error);
}
}
use WPZylos\Framework\Requirements\RequirementsConfig;
$checker = RequirementsConfig::fromFile(
__DIR__ . '/config/
use WPZylos\Framework\Requirements\RequirementsErrorHandler;
$handler = new RequirementsErrorHandler(
$checker->getErrors(),
__FILE__, // plugin file for deactivation
'My Plugin', // plugin name
'my-plugin' // text domain
);
$handler->handle(true); // true = deactivate plugin
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.