diff --git a/src/validation/README.md b/src/validation/README.md index 0d17f8e68..22d64a7dd 100644 --- a/src/validation/README.md +++ b/src/validation/README.md @@ -1,73 +1,44 @@ # Hyperf Validation - ## About [hyperf/validation](https://github.com/hyperf-cloud/validation) 组件衍生于 `Laravel Validation` 组件的,我们对它进行了一些改造,大部分功能保持了相同。在这里感谢一下 Laravel 开发组,实现了如此强大好用的 Validation 组件。 -## Install +## Installation ``` composer require hyperf/validation - ``` ## Config - -### publish config -``` -php bin/hyperf.php vendor:publish hyperf/validation +### Publish config file +``` +php bin/hyperf.php vendor:publish hyperf/validation ``` -### config path +### Configuration path ``` your/config/path/autoload/translation.php - ``` -### config content +### Configuration -``` +```php 'en', 'fallback_locale' => '', 'lang' => BASE_PATH . '/resources/lang', ]; - ``` -### exception handler +### Exception handler -``` +```php [ 'http' => [ @@ -75,49 +46,34 @@ return [ ], ], ]; - ``` -### validation middleware +### Validation middleware -``` +```php [ \Hyperf\Validation\Middleware\ValidationMiddleware::class, ], ]; - ``` ## Usage -### gen request +### Generate form request +Command: ``` php bin/hyperf.php gen:request FooRequest ``` - -``` -class IndexController extends Controller +Usage: +```php +class IndexController { - - public function foo(FooRequest $request) { $request->input('foo'); @@ -149,6 +105,4 @@ class IndexController extends Controller } } } - - -``` \ No newline at end of file +```