Replies: 1 comment
-
Hi @Vagnerlg! I'm sorry for my delay! Yes, that was on my plans for version 3.0. The way I see this rule working would be something like: use Respect\Validation\Rules\Alnum;
use Respect\Validation\Rules\Email;
use Respect\Validation\Validator;
readonly class AccountCreated
{
#[Alnum]
public string $username;
#[Email]
public string $email;
public function __construct(string $username, string $email)
{
$this->username = $username;
$this->email = $email;
}
}
Validator::attribute()->assert(new AccountCreated('pand', '[email protected]')); However, could you tell me a bit more about which use-cases you see for that? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
Do you plan to put the new functionality of PHP 8 "Attributes" ?
https://www.php.net/manual/en/language.attributes.overview.php
Example:
Thank you and congratulations for the project.
Beta Was this translation helpful? Give feedback.
All reactions