Replies: 2 comments
-
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', 'panda@example.com')); 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
-
I've implemented this feature -- finally! 🎉 It will be present in version 3.0, which I plan/hope I can get released at the beginning of next year! https://github.com/Respect/Validation/blob/main/docs/rules/Attributes.md |
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