industrious / wp-helpers
一个 WP 辅助包。
v1.0
2023-02-04 20:39 UTC
Requires
- php: ^8.0
- ext-openssl: *
- guzzlehttp/guzzle: ^7
- hashids/hashids: ^4.1
- illuminate/filesystem: ^9
- illuminate/translation: ^9
- illuminate/validation: ^9
- j7mbo/twitter-api-php: ^1.0
README
简介
industrious/wp-helpers 是一个 [[]].
许可协议
industrious/wp-helpers 是开源软件,遵循 MIT 许可协议
安装
要开始使用 industrious/wp-helpers,请使用 Composer 将包添加到项目的依赖项中
composer require industrious-mouse/wp-helpers
示例
验证辅助工具
以下是如何使用 ValidatesRequests 特性来验证表单的示例。
use ValidatesRequests;
/**
*
*/
public function __construct()
{
$data = [
'abc' => '123',
'def' => '123',
];
$rules = [
'abc' => 'required',
'def' => 'required',
];
$errors = $this->validate($data, $rules);
if (! $errors) {
wp_send_json_success();
}
wp_send_json_error([
'errors' => $errors->toArray()
]);
}