Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit ed03860

Browse files
committed
chore: documentation improvements
1 parent b5c2cf4 commit ed03860

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Yet Another PHP Validator
22

3-
Versatile library focused on validating development code with expressive error messages.
3+
Versatile validator focused on validating development code with expressive error messages.
4+
5+
> **Note**
6+
> This library is not in version 1.x mainly because there are so few available rules.
7+
> Hopefully, that should change in the near future.
48
59
## Requirements
610

@@ -44,6 +48,14 @@ $validator->assert(16, 'Age'); // throws exception: The "Age" value should be gr
4448

4549
## Documentation
4650

51+
- [Get Started](docs/01-get-started.md)
52+
- [Usage](docs/02-usage.md)
53+
- [Usage](docs/02-usage.md#usage)
54+
- [Methods](docs/02-usage.md#methods)
55+
- [Error Handling](docs/02-usage.md#error-handling)
56+
- [Custom Error Messages](docs/02-usage.md#custom-error-messages)
57+
- [Rules](docs/03-rules.md)
58+
- [Custom Rules](docs/04-custom-rules.md)
4759

4860
## Contributing
4961

@@ -52,7 +64,7 @@ Make sure to open a pull request or issue.
5264

5365
## Acknowledgments
5466

55-
This library is inspired by [Respect's Validation](https://github.com/Respect/Validation) and [Symfony's Validator](https://symfony.com/doc/current/validation.html).
67+
This library is inspired by [respect/validation](https://github.com/Respect/Validation) and [symfony/validator](https://symfony.com/doc/current/validation.html).
5668

5769
## License
5870

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "programmatordev/yet-another-php-validator",
3-
"description": "PHP Validator",
3+
"description": "Versatile validator focused on validating development code with expressive error messages.",
44
"type": "library",
55
"keywords": ["PHP", "Validator", "Validation"],
66
"license": "MIT",

docs/01-get-started.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,13 @@ use ProgrammatorDev\YetAnotherPhpValidator\Validator;
3333
// Do this...
3434
$validator = Validator::notBlank()->greaterThanOrEqual(18);
3535

36-
// ...or this...
36+
// Or this...
3737
$validator = new Validator(
3838
new Rule\NotBlank(),
3939
new Rule\GreaterThanOrEqual(18)
4040
);
4141

42-
// ...or even this...
43-
$validator = (new Validator())
44-
->addRule(new Rule\NotBlank())
45-
->addRule(new Rule\GreaterThanOrEqual(18));
46-
47-
// ...and validate with these:
42+
// Validate with these:
4843
$validator->validate(16); // returns bool: false
4944
$validator->assert(16, 'Age'); // throws exception: The "Age" value should be greater than or equal to "18", "16" given.
5045
```

docs/04-custom-rules.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ This means that you can have dynamic content in your messages.
8888
To make it work, just pass an associative array with the name and value of your parameters, and they will be available in the message:
8989

9090
```php
91-
class FavoriteException extends ValidationException {}
92-
9391
class Favorite extends AbstractRule implements RuleInterface
9492
{
9593
public function __construct(
@@ -105,7 +103,7 @@ class Favorite extends AbstractRule implements RuleInterface
105103
'name' => $name,
106104
'favorite' => $this->favorite,
107105
'value' => $value
108-
]
106+
]
109107
)
110108
}
111109
}

0 commit comments

Comments
 (0)