From 49a2e23470c291004f2fb203401408225fb61831 Mon Sep 17 00:00:00 2001 From: Asko Nomm Date: Sun, 27 Feb 2022 22:21:00 +0100 Subject: Allow explicit validation outside of `fails()`. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index fc3e78f..0be14fa 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,12 @@ if ($hird->fails()) { } ``` -From the above example, you can see that there are two Hird methods being used such as `$hird->fails()` and `$hird->errors()`. The `$hird->fails()` method will return a boolean depending on whether the validation failed or not, `true` if it did. The `$hird->errors()` method will return an array of all the errors that occured, as defined by the validators. +From the above example, you can see that there are two Hird methods being used such as `$hird->fails()` and `$hird->errors()`. The `$hird->fails()` method will run the validation and return a boolean depending on whether the validation failed or not, `true` if it did. The `$hird->errors()` method will return an array of all the errors that occured, as defined by the validators. You can also get the first error rather than all errors by using the method `$hird->firstError()`. +If you wish to run the validation without needing to call `$hird->fails()`, you can instead call `$hird->validate()`. + ## Built-in validators There are a number of built-in validators available for use by default. If you want to remove a built-in validator, you can remove one using the `$hird->removeValidator('rule-name')` method. -- cgit v1.2.3