Since the early days, Laravel includes an excellent validator class. Laravel's validator works on any arbitrary array of data but it's typically used for request validation.

When passing an invalid payload array as our input, the validator will fail and provide us with a couple of validation messages: $data = [ 'name' => 'Ruben Van Assche', 'team' => [ 'id' => 2023, 'role' => 'ceo'

Let's take a look at the previous inputs we provided to the validator: [ 'name' => 'Ruben Van Assche', ]; No validation messages 👍 [ 'name' => 'Ruben Van Assche', 'team' => [ 'id' => 1, 'role' => 'engineer', ], ] Also no validation messages 🥳 [ 'name' => 'Ruben Van Assche', 'team' => [ 'id' => 1, 'role' => 'engineer', 'features' => [ 'github' => true, 'jira' => false, ], ], ]
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners