11# Hyperf Validation
22
3-
43## About
54
65[ hyperf/validation] ( https://github.com/hyperf-cloud/validation ) 组件衍生于 ` Laravel Validation ` 组件的,我们对它进行了一些改造,大部分功能保持了相同。在这里感谢一下 Laravel 开发组,实现了如此强大好用的 Validation 组件。
76
8- ## Install
7+ ## Installation
98
109```
1110composer require hyperf/validation
1211```
1312
1413## Config
1514
15+ ### Publish config file
1616
17- ### publish config
1817```
19- php bin/hyperf.php vendor:publish hyperf/validation
18+ php bin/hyperf.php vendor:publish hyperf/validation
2019```
2120
22- ### config path
21+ ### Configuration path
2322
2423```
2524your/config/path/autoload/translation.php
2625```
2726
28- ### config content
27+ ### Configuration
2928
3029``` php
3130<?php
32-
33- declare(strict_types=1);
34-
35- /**
36- * This file is part of Hyperf.
37- *
38- * @link https://www.hyperf.io
39- * @document https://doc.hyperf.io
40- 41- * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
42- */
43-
4431return [
4532 'locale' => 'en',
4633 'fallback_locale' => '',
4734 'lang' => BASE_PATH . '/resources/lang',
4835];
4936```
5037
51- ### exception handler
38+ ### Exception handler
5239
5340``` php
5441<?php
55-
56- declare(strict_types=1);
57-
58- /**
59- * This file is part of Hyperf.
60- *
61- * @link https://www.hyperf.io
62- * @document https://doc.hyperf.io
63- 64- * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
65- */
66-
6742return [
6843 'handler' => [
6944 'http' => [
@@ -73,22 +48,10 @@ return [
7348];
7449```
7550
76- ### validation middleware
51+ ### Validation middleware
7752
7853``` php
7954<?php
80-
81- declare(strict_types=1);
82-
83- /**
84- * This file is part of Hyperf.
85- *
86- * @link https://www.hyperf.io
87- * @document https://doc.hyperf.io
88- 89- * @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
90- */
91-
9255return [
9356 'http' => [
9457 \Hyperf\Validation\Middleware\ValidationMiddleware::class,
@@ -100,15 +63,16 @@ return [
10063## Usage
10164
10265
103- ### gen request
66+ ### Generate form request
10467
68+ Command:
10569```
10670php bin/hyperf.php gen:request FooRequest
10771```
10872
109-
73+ Usage:
11074``` php
111- class IndexController extends Controller
75+ class IndexController
11276{
11377 public function foo(FooRequest $request)
11478 {
0 commit comments