wpdesk/wp-basic-requirements
最新稳定版本:3.8.1
Composer 安装命令:
composer require wpdesk/wp-basic-requirements
包简介
README 文档
README
WP Basic Requirements
wp-basic-requirements is a simple library for WordPress plugins allowing to verify if the target environment meets the defined requirements. If not, it can be also used to display the notice to the users containing the proper information.
The library has to be compatible with PHP 5.2.x since it's the oldest acceptable version for WordPress to be run.
Available requirements to be defined:
- Minimal PHP version
- Minimal WordPress version
- Minimal WooCommerce version
- Required PHP module
- Required PHP setting
- OpenSSL version
Requirements
PHP 5.2 or later.
Installation via Composer
In order to install the bindings via Composer run the following command:
composer require wpdesk/wp-basic-requirements
Example usage
Use the following code in WordPress plugin's main .php file:
<?php
$requirements_checker = ( new WPDesk_Basic_Requirement_Checker_Factory )->create_from_requirement_array(
__FILE__,
'Example plugin name',
[
'php' => '7.0',
'wp' => '6.0',
'plugins' => [
[
'name' => 'woocommerce/woocommerce.php',
'nice_name' => 'WooCommerce',
],
],
]
);
if ( $requirements_checker->are_requirements_met() ) {
// plugin stuff goes here
} else {
$requirements_checker->render_notices();
}
统计信息
- 总下载量: 74.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 5
- 推荐数: 1
其他信息
- 授权协议: Unknown
- 更新时间: 2018-04-16